|
3 | 3 | If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
4 | 4 | Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
5 | 5 | All Rights Reserved.
|
6 |
| - |
7 |
| - Based on Microsoft XAML for Win UI |
8 |
| - Copyright (c) Microsoft Corporation. All Rights Reserved. |
9 | 6 | -->
|
10 | 7 |
|
11 |
| -<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
| 8 | +<ResourceDictionary |
| 9 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 10 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > |
12 | 11 |
|
13 |
| - <Style x:Key="DefaultListViewItemStyle" TargetType="{x:Type ListViewItem}"> |
14 |
| - <Setter Property="Foreground" Value="{DynamicResource ListViewItemForeground}" /> |
15 |
| - <Setter Property="Background" Value="Transparent" /> |
16 |
| - <Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> |
17 |
| - <Setter Property="Margin" Value="0,0,0,2" /> |
18 |
| - <Setter Property="Padding" Value="4" /> |
| 12 | + <Style x:Key="DefaultListViewStyle" TargetType="{x:Type ListView}"> |
| 13 | + <Setter Property="Margin" Value="0" /> |
| 14 | + <Setter Property="Padding" Value="0" /> |
| 15 | + <Setter Property="BorderThickness" Value="0" /> |
| 16 | + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> |
| 17 | + <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> |
| 18 | + <Setter Property="ScrollViewer.CanContentScroll" Value="True" /> |
| 19 | + <Setter Property="VerticalContentAlignment" Value="Center" /> |
| 20 | + <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" /> |
| 21 | + <Setter Property="VirtualizingPanel.VirtualizationMode" Value="Standard" /> |
| 22 | + <Setter Property="SnapsToDevicePixels" Value="True" /> |
19 | 23 | <Setter Property="OverridesDefaultStyle" Value="True" />
|
| 24 | + <Setter Property="ItemsPanel"> |
| 25 | + <Setter.Value> |
| 26 | + <ItemsPanelTemplate> |
| 27 | + <VirtualizingStackPanel IsVirtualizing="{TemplateBinding VirtualizingPanel.IsVirtualizing}" VirtualizationMode="{TemplateBinding VirtualizingPanel.VirtualizationMode}" /> |
| 28 | + </ItemsPanelTemplate> |
| 29 | + </Setter.Value> |
| 30 | + </Setter> |
20 | 31 | <Setter Property="Template">
|
21 | 32 | <Setter.Value>
|
22 |
| - <ControlTemplate TargetType="{x:Type ListBoxItem}"> |
23 |
| - <Border |
24 |
| - x:Name="Border" |
25 |
| - Margin="0" |
26 |
| - Padding="0" |
27 |
| - Background="Transparent" |
28 |
| - BorderThickness="1" |
29 |
| - CornerRadius="{TemplateBinding Border.CornerRadius}"> |
30 |
| - <Grid> |
31 |
| - <ContentPresenter Margin="{TemplateBinding Padding}" /> |
32 |
| - <Rectangle |
33 |
| - x:Name="ActiveRectangle" |
34 |
| - Width="3" |
35 |
| - Height="18" |
36 |
| - Margin="0" |
37 |
| - HorizontalAlignment="Left" |
38 |
| - VerticalAlignment="Center" |
39 |
| - Fill="{DynamicResource ListViewItemPillFillBrush}" |
40 |
| - RadiusX="2" |
41 |
| - RadiusY="2" |
42 |
| - Visibility="Collapsed" /> |
43 |
| - </Grid> |
44 |
| - </Border> |
| 33 | + <ControlTemplate TargetType="{x:Type ListView}"> |
| 34 | + <Grid> |
| 35 | + <PassiveScrollViewer |
| 36 | + x:Name="PART_ContentHost" |
| 37 | + CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}" |
| 38 | + HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" |
| 39 | + VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> |
| 40 | + <ItemsPresenter /> |
| 41 | + </PassiveScrollViewer> |
| 42 | + <Rectangle |
| 43 | + x:Name="PART_DisabledVisual" |
| 44 | + Opacity="0" |
| 45 | + RadiusX="2" |
| 46 | + RadiusY="2" |
| 47 | + Stretch="Fill" |
| 48 | + Stroke="Transparent" |
| 49 | + StrokeThickness="0" |
| 50 | + Visibility="Collapsed"> |
| 51 | + <Rectangle.Fill> |
| 52 | + <SolidColorBrush Color="{DynamicResource ControlFillColorDefault}" /> |
| 53 | + </Rectangle.Fill> |
| 54 | + </Rectangle> |
| 55 | + </Grid> |
45 | 56 | <ControlTemplate.Triggers>
|
46 |
| - <MultiTrigger> |
47 |
| - <MultiTrigger.Conditions> |
48 |
| - <Condition Property="IsEnabled" Value="True" /> |
49 |
| - <Condition Property="IsMouseOver" Value="True" /> |
50 |
| - </MultiTrigger.Conditions> |
51 |
| - <Setter TargetName="Border" Property="Background" Value="{DynamicResource ListViewItemBackgroundPointerOver}" /> |
52 |
| - |
53 |
| - </MultiTrigger> |
54 |
| - <Trigger Property="IsSelected" Value="True"> |
55 |
| - <Setter TargetName="ActiveRectangle" Property="Visibility" Value="Visible" /> |
56 |
| - <Setter TargetName="Border" Property="Background" Value="{DynamicResource ListViewItemBackgroundPointerOver}" /> |
| 57 | + <Trigger Property="IsGrouping" Value="True"> |
| 58 | + <Setter Property="ScrollViewer.CanContentScroll" Value="False" /> |
| 59 | + </Trigger> |
| 60 | + <Trigger Property="IsEnabled" Value="False"> |
| 61 | + <Setter TargetName="PART_DisabledVisual" Property="Visibility" Value="Visible" /> |
57 | 62 | </Trigger>
|
58 | 63 | </ControlTemplate.Triggers>
|
59 | 64 | </ControlTemplate>
|
60 | 65 | </Setter.Value>
|
61 | 66 | </Setter>
|
62 | 67 | </Style>
|
63 | 68 |
|
64 |
| - <Style BasedOn="{StaticResource DefaultListViewItemStyle}" TargetType="{x:Type ListViewItem}" /> |
| 69 | + <Style BasedOn="{StaticResource DefaultListViewStyle}" TargetType="{x:Type ListView}" /> |
65 | 70 |
|
66 | 71 | </ResourceDictionary>
|
0 commit comments