有没有简单的方法来装饰VirtualizingStackPane
l?如果我VirtualizingStackPanel
直接输入ScrollViewer
,虚拟化就可以了。我的目标是覆盖该Decorator.OnRender()
方法并在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}"/>