Is there a simple way to decorate VirtualizingStackPane
l? 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}"/>