开发者

Silverlight toolkit Expander doesn't expand when the size of its content changes

开发者 https://www.devze.com 2023-02-21 21:29 出处:网络
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 anima

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!!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消