3 changed files with 102 additions and 105 deletions
@ -1,91 +1,92 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui" |
<Styles xmlns="https://github.com/avaloniaui" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:local="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"> |
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"> |
||||
<Style Selector="TreeViewItem"> |
<Style Selector="TreeViewItem"> |
||||
<Style.Resources> |
<Style.Resources> |
||||
<local:MarginMultiplierConverter Indent="16" Left="True" x:Key="leftMarginConverter" /> |
<converters:MarginMultiplierConverter Indent="16" Left="True" x:Key="LeftMarginConverter" /> |
||||
</Style.Resources> |
</Style.Resources> |
||||
<Setter Property="Padding" Value="2"/> |
<Setter Property="Padding" Value="2"/> |
||||
<Setter Property="Background" Value="{DynamicResource InvisibleSelectionBrush}"/> |
<Setter Property="Background" Value="{DynamicResource InvisibleSelectionBrush}"/> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<StackPanel> |
<StackPanel> |
||||
<Border Name="SelectionBorder" |
<Border Name="SelectionBorder" |
||||
Focusable="True" |
Focusable="True" |
||||
Background="{TemplateBinding Background}" |
Background="{TemplateBinding Background}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
TemplatedControl.IsTemplateFocusTarget="True"> |
TemplatedControl.IsTemplateFocusTarget="True"> |
||||
<Grid ColumnDefinitions="16, *" Margin="{TemplateBinding Depth, Converter={StaticResource leftMarginConverter}}" > |
<Grid ColumnDefinitions="16, *" |
||||
<ToggleButton Name="expander" |
Margin="{TemplateBinding Depth, Mode=OneWay, Converter={StaticResource LeftMarginConverter}}" > |
||||
Focusable="False" |
<ToggleButton Name="expander" |
||||
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"/> |
Focusable="False" |
||||
<ContentPresenter Name="PART_HeaderPresenter" |
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"/> |
||||
Focusable="False" |
<ContentPresenter Name="PART_HeaderPresenter" |
||||
Content="{TemplateBinding Header}" |
Focusable="False" |
||||
HorizontalContentAlignment="{TemplateBinding HorizontalAlignment}" |
Content="{TemplateBinding Header}" |
||||
Padding="{TemplateBinding Padding}" |
HorizontalContentAlignment="{TemplateBinding HorizontalAlignment}" |
||||
Grid.Column="1"/> |
Padding="{TemplateBinding Padding}" |
||||
</Grid> |
Grid.Column="1"/> |
||||
</Border> |
</Grid> |
||||
<ItemsPresenter Name="PART_ItemsPresenter" |
</Border> |
||||
IsVisible="{TemplateBinding IsExpanded}" |
<ItemsPresenter Name="PART_ItemsPresenter" |
||||
Items="{TemplateBinding Items}" |
IsVisible="{TemplateBinding IsExpanded}" |
||||
ItemsPanel="{TemplateBinding ItemsPanel}" |
Items="{TemplateBinding Items}" |
||||
MemberSelector="{TemplateBinding MemberSelector}"/> |
ItemsPanel="{TemplateBinding ItemsPanel}" |
||||
</StackPanel> |
MemberSelector="{TemplateBinding MemberSelector}"/> |
||||
</ControlTemplate> |
</StackPanel> |
||||
</Setter> |
</ControlTemplate> |
||||
</Style> |
</Setter> |
||||
|
</Style> |
||||
|
|
||||
<Style Selector="TreeViewItem /template/ ToggleButton#expander"> |
<Style Selector="TreeViewItem /template/ ToggleButton#expander"> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<Border Background="Transparent" |
<Border Background="Transparent" |
||||
Width="14" |
Width="14" |
||||
Height="12" |
Height="12" |
||||
HorizontalAlignment="Center" |
HorizontalAlignment="Center" |
||||
VerticalAlignment="Center"> |
VerticalAlignment="Center"> |
||||
<Path Fill="{DynamicResource ThemeForegroundBrush}" |
<Path Fill="{DynamicResource ThemeForegroundBrush}" |
||||
HorizontalAlignment="Center" |
HorizontalAlignment="Center" |
||||
VerticalAlignment="Center" |
VerticalAlignment="Center" |
||||
Data="M 0 2 L 4 6 L 0 10 Z"/> |
Data="M 0 2 L 4 6 L 0 10 Z"/> |
||||
</Border> |
</Border> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
|
|
||||
<Style Selector="TreeViewItem /template/ ContentPresenter#PART_HeaderPresenter"> |
<Style Selector="TreeViewItem /template/ ContentPresenter#PART_HeaderPresenter"> |
||||
<Setter Property="Padding" Value="2"/> |
<Setter Property="Padding" Value="2"/> |
||||
</Style> |
</Style> |
||||
|
|
||||
<Style Selector="TreeViewItem[IsSelected=false] /template/ Border#SelectionBorder[IsPointerOver=true]"> |
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> |
|
||||
</Style> |
|
||||
|
|
||||
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder"> |
<Style Selector="TreeViewItem[IsSelected=false] /template/ Border#SelectionBorder[IsPointerOver=true]"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> |
<Setter Property="Background" Value="{DynamicResource ThemeControlHighlightMidBrush}"/> |
||||
</Style> |
</Style> |
||||
|
|
||||
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder[IsPointerOver=false][IsFocused=true]"> |
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> |
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/> |
||||
</Style> |
</Style> |
||||
|
|
||||
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder[IsPointerOver=true][IsFocused=false]"> |
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder[IsPointerOver=false][IsFocused=true]"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> |
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> |
||||
</Style> |
</Style> |
||||
|
|
||||
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder[IsPointerOver=true][IsFocused=true]"> |
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder[IsPointerOver=true][IsFocused=false]"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/> |
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush3}"/> |
||||
</Style> |
</Style> |
||||
|
|
||||
<Style Selector="TreeViewItem /template/ ToggleButton#expander:checked"> |
|
||||
<Setter Property="RenderTransform"> |
|
||||
<RotateTransform Angle="45"/> |
|
||||
</Setter> |
|
||||
</Style> |
|
||||
|
|
||||
<Style Selector="TreeViewItem:empty /template/ ToggleButton#expander"> |
<Style Selector="TreeViewItem[IsSelected=true] /template/ Border#SelectionBorder[IsPointerOver=true][IsFocused=true]"> |
||||
<Setter Property="IsVisible" Value="False"/> |
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/> |
||||
</Style> |
</Style> |
||||
|
|
||||
|
<Style Selector="TreeViewItem /template/ ToggleButton#expander:checked"> |
||||
|
<Setter Property="RenderTransform"> |
||||
|
<RotateTransform Angle="45"/> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="TreeViewItem:empty /template/ ToggleButton#expander"> |
||||
|
<Setter Property="IsVisible" Value="False"/> |
||||
|
</Style> |
||||
</Styles> |
</Styles> |
||||
|
|||||
Loading…
Reference in new issue