抓住集合被填满并移除加载装饰器的那一刻?
我正在 WPF DataGrid 中对数据进行分组。这需要很长时间,所以我想显示一个加载栏/装饰器。
我正在使用MVVM。当数据网格完成分组时,如何删除/淡出加载栏/装饰器。
如何获得数据 100% 分组的时刻?可以以某种方式在 XAML 中设置或检索等吗?
I am grouping data in a WPF DataGrid. that takes very long so I want to show a Loading bar/adorner.
I am using MVVM. How would you remove/fade out the loading bar/adorner when the datagrid has finished the grouping.
How do I get the moment when the Data is grouped 100%? Can this somehow be set in XAML or retrieved etc.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您可以使用
ItemContainerGenerator.StatusChanged
事件。当状态变为ContainersGenelated
时,分组完成。请注意,这只是一个假设,但我怀疑当您更改
GroupDescriptions
时容器会重新生成...I think you could use the
ItemContainerGenerator.StatusChanged
event. When the status will change toContainersGenerated
, the grouping is complete.Note that it's just an assumption, but I suspect the containers are regenerated when you change the
GroupDescriptions
...一种解决方案可能是绑定到扩展器的可见性。因为只有当所有数据都分组时,扩展器才可见。但这仅当您将 IsExpanded 设置为 TRUE 时才有效,否则扩展器立即可见,并且当您单击扩展器箭头时会发生分组。
我的 Expander 在默认设置下未展开。所以我尝试通过剥离 RowStyle 和 CellStyle 来加速扩展器的扩展。这是我在不破坏显示交替背景的不可编辑网格的功能的情况下可以实现的最小 xaml
现在扩展速度更快,我猜大约 30-40%。至少我在视觉上认出了它。 :)
one solution could be to bind to the Visibilty of the Expander. Because only when all data is grouped the expander is visible. But this works only when you set the IsExpanded to TRUE, else the expander is visible immediately and the grouping happens when you click on the expander arrow.
My Expander is not expanded in default setting. So I tried to speed up the expanding of the expander by ripping the RowStyle and CellStyle. This is the minimum of xaml I could achieve without breaking my functionality of a not editable grid showing alternating BackGround
The expanding goes faster now I guess approximately 30-40%. At least I recognize it visually. :)