wpf datagrid是否有像winforms DataGridView那样的虚拟模式?
winforms DataGridView
有一个虚拟模型,并使用 OnCellValueNeeded
方法从用户定义的数据存储中获取单元格值。
我如何在 wpf 中执行此操作? DataGrid
似乎没有 OnCellValueNeeded
方法。
谢谢
The winforms DataGridView
has a virtual model and uses the OnCellValueNeeded
method to gets cell values from a a user defined data store.
How do i do this in wpf? The DataGrid
doesn't seems to have a OnCellValueNeeded
method.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定这是否对您有帮助:
DataGrid 使用UI 虚拟化,这意味着对象在屏幕上可见之前不会被创建,并且只要源对象的相应属性在它们可见之前就不会被调用。不可见。这也意味着 ui 元素在不再可见后会被回收。
这是免费的,您无需进行额外的编码即可使用此功能。如果我正确解释你的问题,那么主要问题是,如何知道需要业务对象的属性。对于 UI 虚拟化,这是第一次调用属性时 - 您可以执行一些延迟初始化。但要注意在属性中放入过多的初始化代码(数据库同步查找等),否则您的 DataGrid 将变得非常慢且不方便。
Not sure if this already helps you:
DataGrid uses UI virtualization, what means that objects are not created before they are visible on screen and the corresponding properties of your source objects will not be called as long as they are not visible. It means also that ui-elements are recycled after they are no more visible.
This is for free and you don't have to do additional coding to use this feature. If I interprete your question right, the main question is, how to know that a property of a business-object is needed. For UI-virtualization, this is when the property is called the first time - You can do some lazy initialization. But beware to put too heavy initialization code into the properties (DB synchronous lookups etc), otherwise your DataGrid will become very slow and unhandy.