0

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.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Dominic
  • 62,658
  • 20
  • 139
  • 163

1 Answers1

0

My problem was with setting the Height to Auto. It must either be fixed, or use a * instead. In my instance in RowDefinition.

Dominic
  • 62,658
  • 20
  • 139
  • 163