WPF implements UI Virtualization via VirtualizingStackPanel and it works great, but situation with Data Virtualization is a bit more complex.
After doing some experimentation I realized that VirtualizingStackPanel when used with WPF TreeView does not allow the data to be virtualized because it iterates through all the collection of data items from inside its MeasureOverride function. However, it access only visible data items when used with DataGrid or ListView, so it allows to use some paging or caching techniques in this case. See the following articles for more information:
- WPF: Data Virtualization – some simple example that uses paging technique.
- UI Virtualization vs. Data Virtualization (Part 1) – interesting sample that uses Dispatcher for deferred loading.
If you interested on what I tried to do with TreeView, please read below.