ScatterViewItem 可以动态调整大小以适应其内容吗?
我们在 ScatterViewItem 内部托管一个控件,该控件由于添加、删除和/或折叠各种子元素而在运行时动态更改其大小。我们希望托管 ScatterViewItem 也能调整大小以正确适应其子控件,但我们很难实现这一点。我们尝试了许多不同的方法,最接近的方法是挂钩子控件的 SizeChanged 事件并显式设置 ScatterViewItem 的宽度和高度,但这种方法仍然存在问题。
当您在 XAML 中定义 ScatterViewItem 及其内容时,ScatterViewItem 的大小会适当调整。当内容大小发生变化时,我们希望在运行时强制执行相同的行为。任何帮助将不胜感激。谢谢!
We're hosting a control inside of a ScatterViewItem that dynamically changes its size at runtime as a result of having various sub-elements added, removed, and/or collapsed. We would like to have the hosting ScatterViewItem resize as well to properly fit its child controls, but we're having a hard time making this happen. We've tried a number of different things and the closest we've come is hooking into the child control's SizeChanged event and explicitly setting the ScatterViewItem's Width and Height, but this approach still has issues.
When you define a ScatterViewItem and its content in XAML, the ScatterViewItem is sized appropriately. We would like to force the same behavior at runtime when its content changes size. Any help would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过设置此处描述的样式:
http://msdn.microsoft.com/ en-us/library/ee957369.aspx
在“绑定到内容大小”下?
Have you tried setting the style described here:
http://msdn.microsoft.com/en-us/library/ee957369.aspx
under "Binding to Content Size"?