I found while working a project recently, that when I added the styling for Grouping, even if I wasn’t actually using it, that the load time for my data was massively affected.

Evidently, the reason or this slow down is due to the fact that, unbeknown to me, when grouping is enabled in WPF, then Virtualisation is disabled by default.

Virtualisation allows WPF to not physically render items which don’t appear directly in the UI, thus it doesn’t need to perform all the complicated UI math related to showing UI elements. This vastly improves performance, in my case, when dealing with Data Sources which have rows exceeding a few hundred.

Thankfully, WPF and .Net 4.5 has enabled a way for Virtualisation to be re-enabled when grouping. Simply adding the following to the Datagrid re-enabled Virtualisation.

VirtualizingStackPanel.IsVirtualizing="True"

By | 2015-02-01T11:28:14+00:00 June 19th, 2013|.Net Framework, Tips, WPF|0 Comments

About the Author:

Leave A Comment