Silverlight工具包Expander在其内容大小发生变化时不会扩展
我有一个包含网格的 silverlight 扩展器控件。在网格中,我有许多文本框、组合框以及一些不可见(折叠)的文本块。我还有一个动画,当它被触发时,网格会显示那些隐藏的文本块。
我的问题是,当动画运行后显示隐藏的文本块时,这些文本块会将其他控件向下推,并且由于扩展器不会自行调整大小,因此底部的控件会被推到扩展器之外并变得不可见。
我尝试在网格的 SizeChanged 事件之后调用 UpdateLayout() 但不起作用。
任何有关如何解决此问题的建议将不胜感激!
I have a silverlight expander control which wraps a grid. In the grid, I have a number of text boxes, combo boxes as well as some invisable (collapsed) text blocks. I also have an animation and when it is triggered the grid shows those hidden text blocks.
My problem is, when the hidden text blocks are shown after the animation is run, these text blocks push other controls down and because the expander doesn't resize itself, the controls at the bottom get pushed outside of the expander and become invisible.
I tried to call UpdateLayout() after the SizeChanged event of the grid but doesn't work.
Any suggestions on how to resolve this issue would be much appreciated!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我实际上已经自己解决了这个问题。我发现在扩展器控件的样式中,不久前我放置了 ExpandableContentControl 而不是普通的 ContentControl,因为当您展开/折叠它时它有一个很好的动画。但此控件无法正确调整大小...(请参阅 http://silverlight.codeplex。 com/workitem/4544?ProjectName=silverlight)我想这就是为什么 AccordionItem 控件如此错误,因为它还有一个 ExpandableContentControl 。当我用普通的 ContentControl 替换 ExpandableContentControl 后,扩展器就按预期工作了。 :)
I actually have fixed this problem by myself. I discovered in the style of the expander control, a while ago I put an ExpandableContentControl instead of normal ContentControl because it has a nice animation when you expand/collpase it. But this control doesn't resize properly... (see http://silverlight.codeplex.com/workitem/4544?ProjectName=silverlight) I guess this is why the AccordionItem control is so buggy because it also has an ExpandableContentControl in it. As soon as I replaced the ExpandableContentControl with a normal ContentControl, the expander worked as expected. :)
问题是因为扩展器总是使用相同的宽度(或高度),所以您必须通过代码重新计算网格的宽度并将其分配给列定义。
The problems is because the expander always use the same width (or height), so you must recalculate the width of the grid by code and assign it to the columndefinition.