DataGrid - 创建所有列后发生事件?
看起来我正在尝试做一些简单的事情,但我有一种奇怪的感觉,我正在使用一些非常奇怪的方法来实现这一目标。
我有几个 Silverlight DataGrid
对象,其中包含许多自定义生成的列。这些列是在 AutogenerateColumn
事件之一期间生成的。生成并显示所有列后,我想同步它们的宽度和顺序(换句话说:我正在创建一些“链接”网格,它们显示不同的数据,但以非常相似的方式)。
我面临的问题是? DataGrid 似乎没有在加载所有数据并绘制列后触发的事件。
目前我正在使用 LayoutUpdated
事件并检查列数是否应有。这可行,但我无法摆脱这种感觉:这是一个丑陋的解决方法。
DataGrid 创建完所有列后,是否有更好的方法来执行操作?
It seems I'm trying to do something simple, and I've got this weird feeling I'm using some really strange methods to achieve this.
I've got a couple of Silverlight DataGrid
objects with a lot of custom-generated columns. These columns are generated during one of the AutogenerateColumn
events. After all the columns have been generated and displayed, I want to synchronize their width and order (in other words: I'm creating a few "linked" grids which display different data but in a very similar manner).
The problem I'm facing? DataGrid doesn't seem to have an event that gets fired after all the data has been loaded and the columns have been drawn.
For the time being I'm using the LayoutUpdated
event and check if the column count is what it should be. This works, but I can't shake the feeling that this is an ugly workaround.
Is there any better way to do things as soon as all the columns have been created by the DataGrid?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终使用了 LayoutUpdate...悲伤,但它就是这样。
I ended up using LayoutUpdate... sad, but there it is.
假设您对所有列进行手动编辑,您可以在分配 itemSource 后调用一个方法,因为列的更新是在您设置它之后发生的。
Assuming you do a manual edit of all the columns, you could just call a method after you assign the itemSource, since the updating of columns occurs after you set it.