When we display large numbers of items in our collection controls, it can negatively affect the application's performance. This is because the layout system will create a layout container, such as a
ComboBoxItem in the case of a
ComboBox for example, for every item in the data bound collection. As only a small subset of the complete number of items is displayed at any one time, we can take advantage of virtualization to improve the situation.
UI virtualization defers the generation and layout of these item containers until each item is actually visible in the relevant collection control, often saving on large amounts of resources. We can take advantage of virtualization without doing anything at all if we use
ListView controls to display our collections, as they use it by default.
Virtualization can also be enabled in
TreeView controls, although it will have to be done manually. When using a
TreeView control, we can enable virtualization...