WPF 数据虚拟化 ListView
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/981040/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WPF Data virtualizing ListView
提问by Robert Jeppesen
In our current WinForms app, we are displaying millions of records in ListView, using virtualization. Rows are loaded from DB as they are requested. This works well, with good performance.
在我们当前的 WinForms 应用程序中,我们使用虚拟化在 ListView 中显示数百万条记录。行在请求时从 DB 加载。这运行良好,性能良好。
This is a showstopper for migrating to WPF for us. We need data virtualization in a ListView, like WinForms 2.0 has.
这是我们迁移到 WPF 的一大亮点。我们需要在 ListView 中进行数据虚拟化,就像 WinForms 2.0 那样。
Do you know a decent third-party control, or a relatively easy way of doing it with built-in controls? It doesn't need to be a DataGrid, a simple ListView will suffice.
您知道一个不错的第三方控件,还是使用内置控件进行操作的相对简单的方法?它不需要是 DataGrid,一个简单的 ListView 就足够了。
Note, I'm note talking about UI virtualization, it's data virtualization.
注意,我说的是 UI 虚拟化,它是数据虚拟化。
回答by Martin Konicek
The article WPF Data Virtualizationshould be exactly what you are looking for, I just implemented it quite easily, and it works.
文章WPF Data Virtualization应该正是您正在寻找的内容,我只是很容易地实现了它,并且它有效。
回答by Samuel Hyman
Xceed DataGrid for WPFhas data virtualization support.
Xceed DataGrid for WPF具有数据虚拟化支持。
回答by Dahdahm
This is the description for the Ultimate ListBox for WPFfrom Xceed:
这是Xceed对 WPF Ultimate ListBox的描述:
Intelligent virtualized background data retrieval:
Automatic data retrieval only gets records from the remote data source if they are visible (data virtualization). This greatly reduces the amount of data to be transferred, which increases the perceived speed of the listbox. Also reduces strain on the server.
智能虚拟化后台数据检索:
自动数据检索仅从远程数据源中获取可见的记录(数据虚拟化)。这大大减少了要传输的数据量,从而提高了列表框的感知速度。还减少了服务器的压力。
回答by khushi pari
Just add following properties in your listview declaration in XAML.
只需在 XAML 的列表视图声明中添加以下属性。
<ListView
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
VirtualizingPanel.VirtualizationMode="Recycling"
ScrollViewer.IsDeferredScrollingEnabled="True" >
</ListView>