Ver código fonte

Added style for virtualising itemscontrols

Kenric Nugteren 1 ano atrás
pai
commit
b53e3f92c8
1 arquivos alterados com 28 adições e 0 exclusões
  1. 28 0
      prs.desktop/App.xaml

+ 28 - 0
prs.desktop/App.xaml

@@ -15,6 +15,34 @@
 
 
                 <ResourceDictionary>
                 <ResourceDictionary>
 
 
+                    <Style x:Key="VirtualisedItemsControlStyle" TargetType="ItemsControl">
+                        <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
+                        <Setter Property="ItemsPanel">
+                            <Setter.Value>
+                                <ItemsPanelTemplate>
+                                    <VirtualizingStackPanel/>
+                                </ItemsPanelTemplate>
+                            </Setter.Value>
+                        </Setter>
+                        <Setter Property="Template">
+                            <Setter.Value>
+                                <ControlTemplate TargetType="ItemsControl">
+                                    <Border BorderThickness="{TemplateBinding BorderThickness}"
+                                            BorderBrush="{TemplateBinding BorderBrush}"
+                                            Background="{TemplateBinding Background}"
+                                            SnapsToDevicePixels="True">
+                                        <ScrollViewer CanContentScroll="True"
+                                                      Padding="{TemplateBinding Padding}"
+                                                      Focusable="False"
+                                                      VerticalScrollBarVisibility="Auto">
+                                            <ItemsPresenter/>
+                                        </ScrollViewer>
+                                    </Border>
+                                </ControlTemplate>
+                            </Setter.Value>
+                        </Setter>
+                    </Style>
+
                     <Style x:Key="TemplateHeaderStyle" TargetType="{x:Type syncfusion:GridHeaderCellControl}">
                     <Style x:Key="TemplateHeaderStyle" TargetType="{x:Type syncfusion:GridHeaderCellControl}">
                         <Setter Property="Background" Value="LightSkyBlue"/>
                         <Setter Property="Background" Value="LightSkyBlue"/>
                         <Setter Property="Foreground" Value="Black"/>
                         <Setter Property="Foreground" Value="Black"/>