|
| 1 | +<ResourceDictionary xmlns="https://github.com/avaloniaui" |
| 2 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | + xmlns:hc="clr-namespace:HandyControl.Controls"> |
| 4 | + <Geometry x:Key="TreeArrow">M508.893248 762.931659a65.039498 65.039498 0 0 1-46.420659-19.485839L97.125746 371.004022c-25.143018-25.634319-24.752868-66.816849 0.881451-91.959868 25.648769-25.164693 66.809624-24.745643 91.959867 0.881451l318.933409 325.125238 318.933408-325.125238a65.025048 65.025048 0 0 1 92.841318 91.078417L555.313907 743.44582a65.025048 65.025048 0 0 1-46.420659 19.485839z</Geometry> |
| 5 | + |
| 6 | + <ControlTheme x:Key="ExpandCollapseToggleStyle" |
| 7 | + TargetType="ToggleButton"> |
| 8 | + <Setter Property="Width" |
| 9 | + Value="16" /> |
| 10 | + <Setter Property="Height" |
| 11 | + Value="16" /> |
| 12 | + <Setter Property="Template"> |
| 13 | + <ControlTemplate> |
| 14 | + <Border Background="Transparent" |
| 15 | + Height="16" |
| 16 | + Padding="4" |
| 17 | + Width="16"> |
| 18 | + <Path x:Name="expandPath" |
| 19 | + Stretch="Uniform" |
| 20 | + HorizontalAlignment="Center" |
| 21 | + VerticalAlignment="Center" |
| 22 | + Data="{StaticResource TreeArrow}" |
| 23 | + Fill="{TemplateBinding Foreground}"> |
| 24 | + <Path.RenderTransform> |
| 25 | + <RotateTransform Angle="-90" /> |
| 26 | + </Path.RenderTransform> |
| 27 | + </Path> |
| 28 | + </Border> |
| 29 | + </ControlTemplate> |
| 30 | + </Setter> |
| 31 | + |
| 32 | + <Style Selector="^:checked /template/ Path#expandPath"> |
| 33 | + <Setter Property="RenderTransform"> |
| 34 | + <RotateTransform Angle="0" /> |
| 35 | + </Setter> |
| 36 | + </Style> |
| 37 | + </ControlTheme> |
| 38 | + |
| 39 | + <ControlTheme x:Key="TreeViewItemBaseStyle" |
| 40 | + TargetType="TreeViewItem"> |
| 41 | + <Setter Property="Padding" |
| 42 | + Value="10,0" /> |
| 43 | + <Setter Property="MinHeight" |
| 44 | + Value="{StaticResource DefaultControlHeight}" /> |
| 45 | + <Setter Property="Background" |
| 46 | + Value="{DynamicResource RegionBrush}" /> |
| 47 | + <Setter Property="BorderBrush" |
| 48 | + Value="Transparent" /> |
| 49 | + <Setter Property="CornerRadius" |
| 50 | + Value="{Binding $self.(hc:BorderElement.CornerRadius)}" /> |
| 51 | + <Setter Property="BorderThickness" |
| 52 | + Value="0" /> |
| 53 | + <Setter Property="Margin" |
| 54 | + Value="0,0,0,2" /> |
| 55 | + <Setter Property="Template"> |
| 56 | + <ControlTemplate> |
| 57 | + <StackPanel> |
| 58 | + <Border Name="SelectionBorder" |
| 59 | + MinHeight="{TemplateBinding MinHeight}" |
| 60 | + Background="{TemplateBinding Background}" |
| 61 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 62 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 63 | + CornerRadius="{TemplateBinding CornerRadius}" |
| 64 | + Focusable="True" |
| 65 | + Padding="{TemplateBinding Padding}" |
| 66 | + TemplatedControl.IsTemplateFocusTarget="True"> |
| 67 | + <Grid Name="PART_Header" |
| 68 | + Margin="{TemplateBinding Level, Mode=OneWay, Converter={StaticResource LeftMarginConverter}}" |
| 69 | + ColumnDefinitions="16, *"> |
| 70 | + <ToggleButton Name="PART_ExpandCollapseChevron" |
| 71 | + Focusable="False" |
| 72 | + Background="Transparent" |
| 73 | + IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" |
| 74 | + Theme="{StaticResource ExpandCollapseToggleStyle}" /> |
| 75 | + <ContentPresenter Name="PART_HeaderPresenter" |
| 76 | + Grid.Column="1" |
| 77 | + Background="Transparent" |
| 78 | + VerticalAlignment="Center" |
| 79 | + HorizontalContentAlignment="{TemplateBinding HorizontalAlignment}" |
| 80 | + Content="{TemplateBinding Header}" |
| 81 | + ContentTemplate="{TemplateBinding HeaderTemplate}" |
| 82 | + Focusable="False" /> |
| 83 | + </Grid> |
| 84 | + </Border> |
| 85 | + <ItemsPresenter Name="PART_ItemsPresenter" |
| 86 | + IsVisible="{TemplateBinding IsExpanded}" |
| 87 | + ItemsPanel="{TemplateBinding ItemsPanel}" /> |
| 88 | + </StackPanel> |
| 89 | + </ControlTemplate> |
| 90 | + </Setter> |
| 91 | + |
| 92 | + <Style Selector="^ /template/ Border#SelectionBorder:pointerover"> |
| 93 | + <Setter Property="Background" |
| 94 | + Value="{DynamicResource SecondaryRegionBrush}" /> |
| 95 | + </Style> |
| 96 | + |
| 97 | + <Style Selector="^:selected"> |
| 98 | + <Style Selector="^ /template/ Border#SelectionBorder, ^ /template/ Border#SelectionBorder:pointerover"> |
| 99 | + <Setter Property="Background" |
| 100 | + Value="{DynamicResource PrimaryBrush}" /> |
| 101 | + </Style> |
| 102 | + <Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter"> |
| 103 | + <Setter Property="Foreground" |
| 104 | + Value="{DynamicResource TextIconBrush}" /> |
| 105 | + </Style> |
| 106 | + <Style Selector="^ /template/ ToggleButton#PART_ExpandCollapseChevron"> |
| 107 | + <Setter Property="Foreground" |
| 108 | + Value="{DynamicResource TextIconBrush}" /> |
| 109 | + </Style> |
| 110 | + </Style> |
| 111 | + |
| 112 | + <Style Selector="^:empty /template/ ToggleButton#PART_ExpandCollapseChevron"> |
| 113 | + <Setter Property="IsVisible" |
| 114 | + Value="False" /> |
| 115 | + </Style> |
| 116 | + |
| 117 | + <Style Selector="^:disabled"> |
| 118 | + <Setter Property="Opacity" |
| 119 | + Value="0.4" /> |
| 120 | + </Style> |
| 121 | + </ControlTheme> |
| 122 | + |
| 123 | + <ControlTheme x:Key="TreeViewBaseStyle" |
| 124 | + TargetType="TreeView"> |
| 125 | + <Setter Property="Background" |
| 126 | + Value="{DynamicResource RegionBrush}" /> |
| 127 | + <Setter Property="BorderBrush" |
| 128 | + Value="{DynamicResource BorderBrush}" /> |
| 129 | + <Setter Property="BorderThickness" |
| 130 | + Value="1" /> |
| 131 | + <Setter Property="CornerRadius" |
| 132 | + Value="{Binding $self.(hc:BorderElement.CornerRadius)}" /> |
| 133 | + <Setter Property="Padding" |
| 134 | + Value="2,2,2,0" /> |
| 135 | + <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" |
| 136 | + Value="Auto" /> |
| 137 | + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" |
| 138 | + Value="Auto" /> |
| 139 | + <Setter Property="ScrollViewer.IsScrollChainingEnabled" |
| 140 | + Value="True" /> |
| 141 | + <Setter Property="ItemContainerTheme" |
| 142 | + Value="{StaticResource TreeViewItemBaseStyle}" /> |
| 143 | + <Setter Property="hc:BorderElement.CornerRadius" |
| 144 | + Value="{StaticResource DefaultCornerRadius}" /> |
| 145 | + <Setter Property="Template"> |
| 146 | + <ControlTemplate> |
| 147 | + <Border BorderBrush="{TemplateBinding BorderBrush}" |
| 148 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 149 | + Background="{TemplateBinding Background}" |
| 150 | + CornerRadius="{TemplateBinding CornerRadius}"> |
| 151 | + <ScrollViewer AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}" |
| 152 | + BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}" |
| 153 | + HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" |
| 154 | + IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}" |
| 155 | + IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}" |
| 156 | + VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}" |
| 157 | + VerticalSnapPointsType="{TemplateBinding (ScrollViewer.VerticalSnapPointsType)}" |
| 158 | + HorizontalSnapPointsType="{TemplateBinding (ScrollViewer.HorizontalSnapPointsType)}"> |
| 159 | + <ItemsPresenter Name="PART_ItemsPresenter" |
| 160 | + Margin="{TemplateBinding Padding}" |
| 161 | + ItemsPanel="{TemplateBinding ItemsPanel}" /> |
| 162 | + </ScrollViewer> |
| 163 | + </Border> |
| 164 | + </ControlTemplate> |
| 165 | + </Setter> |
| 166 | + </ControlTheme> |
| 167 | + |
| 168 | + <ControlTheme x:Key="{x:Type TreeView}" |
| 169 | + BasedOn="{StaticResource TreeViewBaseStyle}" |
| 170 | + TargetType="TreeView" /> |
| 171 | + |
| 172 | + <ControlTheme x:Key="TreeViewItemBaseStyle.Small" |
| 173 | + BasedOn="{StaticResource TreeViewItemBaseStyle}" |
| 174 | + TargetType="TreeViewItem"> |
| 175 | + <Setter Property="Padding" |
| 176 | + Value="6,0" /> |
| 177 | + <Setter Property="MinHeight" |
| 178 | + Value="24" /> |
| 179 | + </ControlTheme> |
| 180 | + |
| 181 | + <ControlTheme x:Key="TreeView.Small" |
| 182 | + BasedOn="{StaticResource TreeViewBaseStyle}" |
| 183 | + TargetType="TreeView"> |
| 184 | + <Setter Property="ItemContainerTheme" |
| 185 | + Value="{StaticResource TreeViewItemBaseStyle.Small}" /> |
| 186 | + </ControlTheme> |
| 187 | +</ResourceDictionary> |
0 commit comments