重绘 silverlight 手风琴项目不起作用
我在手风琴中有一个数据网格,我以编程方式向其中添加项目。添加项目没有问题,但手风琴项目不会刷新到可以查看数据网格的所有内容的大小。如果我拖动数据网格两侧来调整其大小,则手风琴项目会正确调整大小。我似乎无法通过代码自动执行此操作。我已经在网格或手风琴项目上尝试过 InvalidateArrage 和 InvalidateMeasure,并且还尝试过更改控件的宽度或高度,但似乎没有任何效果可以通过代码进行。我什至尝试过 LayoutRoot 上的 Invalidate 方法。有什么我可以做的代码明智地使手风琴项目刷新到正确的大小吗?
I have a datagrid in an accordion that I programmatically add items to. The items don't have a problem being added, but the accordion item doesn't refresh to a size that can view all the contents of the datagrid. If I drag the datagrids sides to resize it, the accordion item resizes correctly. I can't seem to do this automatically through code. I have tried InvalidateArrage and InvalidateMeasure on the grid or the accordion item and I've also tried changing the widths or heights of the controls, but nothing seems to work through code. I've even tried the Invalidate methods on the LayoutRoot. Is there anything I can do code wise to make the accordion item refresh to the proper size?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有同样的问题,但是在 AccordionItem 中使用 ListBox。我解决了这个问题 - 将您的 DataGrid 放入网格控件中
,当您更改 ItemsSource (添加项目)时,您需要调用 UpdateLayout() 方法
I have the same issue, but with ListBox in AccordionItem. I solve this - put your DataGrid in Grid control
And you need to call UpdateLayout() method when you ItemsSource is changed (item added)