Virtualization works when the TreeView is the only thing in the Window. For example:
<Grid>
<vw:FontTreeView x:Name="fontTreeViewControl" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="0" />
</Grid>
But even simply adding row definitions breaks the virtualization entirely:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<vw:FontTreeView x:Name="fontTreeViewControl" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="0" />
</Grid>
My TreeViewItem style has the following trigger:
<Style.Triggers>
<Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="true">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
And of course the TreeView has VirtualizingStackPanel.IsVirtualizing="True"
Q. How can I have other elements in my window without breaking the virtualization? Thank you help is much appreciated.