1

Is there a simple way to decorate VirtualizingStackPanel? If I put VirtualizingStackPanel directly in ScrollViewer, virtualization will work. My goal is to override the Decorator.OnRender() method and draw some geometry behind a Panel.

<Window.Resources>
    <ControlTemplate x:Key="MyControlTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <ScrollViewer CanContentScroll="True">
                <Border> <!--Decorator breaks virtualization-->
                    <VirtualizingStackPanel IsItemsHost="True"/>
                </Border>
            </ScrollViewer>
        </Grid>
    </ControlTemplate>
</Window.Resources>

<ItemsControl x:Name="MyControl" Template="{StaticResource MyControlTemplate}"/>
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
user990095
  • 23
  • 5

0 Answers0