|
12 | 12 | <Style x:Key="MaterialDesignExpanderToggleButton" TargetType="{x:Type ToggleButton}">
|
13 | 13 | <Setter Property="Template">
|
14 | 14 | <Setter.Value>
|
15 |
| - <ControlTemplate TargetType="{x:Type ToggleButton}"> |
16 |
| - <Border Background="Transparent"> |
17 |
| - <VisualStateManager.VisualStateGroups> |
18 |
| - <VisualStateGroup x:Name="CheckStates"> |
19 |
| - <VisualState x:Name="Checked"> |
20 |
| - <Storyboard> |
21 |
| - <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandPathRotateTransform" Storyboard.TargetProperty="Angle"> |
22 |
| - <EasingDoubleKeyFrame KeyTime="{StaticResource ExpandKeyTime}" Value="180" /> |
23 |
| - </DoubleAnimationUsingKeyFrames> |
24 |
| - </Storyboard> |
25 |
| - </VisualState> |
26 |
| - <VisualState x:Name="Unchecked"> |
27 |
| - <Storyboard> |
28 |
| - <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandPathRotateTransform" Storyboard.TargetProperty="Angle"> |
29 |
| - <EasingDoubleKeyFrame KeyTime="{StaticResource CollapseKeyTime}" Value="0" /> |
30 |
| - </DoubleAnimationUsingKeyFrames> |
31 |
| - </Storyboard> |
32 |
| - </VisualState> |
33 |
| - </VisualStateGroup> |
34 |
| - </VisualStateManager.VisualStateGroups> |
35 |
| - <wpf:PackIcon x:Name="ExpandPath" |
36 |
| - Width="24" |
37 |
| - Height="24" |
38 |
| - Foreground="{TemplateBinding Foreground}" |
39 |
| - Kind="ChevronDown" |
40 |
| - Opacity="0.38" |
41 |
| - RenderTransformOrigin="0.5 0.5"> |
42 |
| - <wpf:PackIcon.RenderTransform> |
43 |
| - <RotateTransform x:Name="ExpandPathRotateTransform" /> |
44 |
| - </wpf:PackIcon.RenderTransform> |
45 |
| - </wpf:PackIcon> |
46 |
| - </Border> |
| 15 | + <ControlTemplate> |
| 16 | + <ContentControl Content="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonContent)}" /> |
47 | 17 | </ControlTemplate>
|
48 | 18 | </Setter.Value>
|
49 | 19 | </Setter>
|
| 20 | + <Style.Triggers> |
| 21 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonContent)}" Value="{x:Null}"> |
| 22 | + <Setter Property="Template"> |
| 23 | + <Setter.Value> |
| 24 | + <ControlTemplate TargetType="{x:Type ToggleButton}"> |
| 25 | + <Border Background="Transparent"> |
| 26 | + <VisualStateManager.VisualStateGroups> |
| 27 | + <VisualStateGroup x:Name="CheckStates"> |
| 28 | + <VisualState x:Name="Checked"> |
| 29 | + <Storyboard> |
| 30 | + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandPathRotateTransform" Storyboard.TargetProperty="Angle"> |
| 31 | + <EasingDoubleKeyFrame KeyTime="{StaticResource ExpandKeyTime}" Value="180" /> |
| 32 | + </DoubleAnimationUsingKeyFrames> |
| 33 | + </Storyboard> |
| 34 | + </VisualState> |
| 35 | + <VisualState x:Name="Unchecked"> |
| 36 | + <Storyboard> |
| 37 | + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandPathRotateTransform" Storyboard.TargetProperty="Angle"> |
| 38 | + <EasingDoubleKeyFrame KeyTime="{StaticResource CollapseKeyTime}" Value="0" /> |
| 39 | + </DoubleAnimationUsingKeyFrames> |
| 40 | + </Storyboard> |
| 41 | + </VisualState> |
| 42 | + </VisualStateGroup> |
| 43 | + </VisualStateManager.VisualStateGroups> |
| 44 | + <wpf:PackIcon x:Name="ExpandPath" |
| 45 | + Width="24" |
| 46 | + Height="24" |
| 47 | + Foreground="{TemplateBinding Foreground}" |
| 48 | + Kind="ChevronDown" |
| 49 | + Opacity="0.38" |
| 50 | + RenderTransformOrigin="0.5 0.5"> |
| 51 | + <wpf:PackIcon.RenderTransform> |
| 52 | + <RotateTransform x:Name="ExpandPathRotateTransform" /> |
| 53 | + </wpf:PackIcon.RenderTransform> |
| 54 | + </wpf:PackIcon> |
| 55 | + </Border> |
| 56 | + </ControlTemplate> |
| 57 | + </Setter.Value> |
| 58 | + </Setter> |
| 59 | + </DataTrigger> |
| 60 | + </Style.Triggers> |
50 | 61 | </Style>
|
51 | 62 |
|
52 | 63 | <Style x:Key="MaterialDesignHorizontalHeaderStyle" TargetType="{x:Type ToggleButton}">
|
|
58 | 69 | <Border Padding="{Binding Path=(wpf:ExpanderAssist.HorizontalHeaderPadding), RelativeSource={RelativeSource AncestorType=Expander, AncestorLevel=1}}" Background="{TemplateBinding Background}">
|
59 | 70 | <Grid>
|
60 | 71 | <Grid.ColumnDefinitions>
|
| 72 | + <ColumnDefinition Width="Auto" /> |
61 | 73 | <ColumnDefinition Width="*" />
|
62 |
| - <ColumnDefinition Width="16" /> |
63 | 74 | <ColumnDefinition Width="Auto" />
|
64 | 75 | </Grid.ColumnDefinitions>
|
65 | 76 |
|
66 |
| - <ContentPresenter Grid.Column="0" |
| 77 | + <ContentPresenter x:Name="ExpanderHeader" |
| 78 | + Grid.Column="1" |
67 | 79 | VerticalAlignment="Center"
|
68 | 80 | Content="{TemplateBinding Content}"
|
69 | 81 | ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
70 | 82 | ContentTemplate="{TemplateBinding ContentTemplate}"
|
71 | 83 | ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
|
72 | 84 |
|
73 | 85 | <ToggleButton x:Name="ExpanderButton"
|
74 |
| - Grid.Column="2" |
75 | 86 | VerticalAlignment="Center"
|
76 | 87 | Foreground="{TemplateBinding Foreground}"
|
77 | 88 | IsChecked="{Binding Path=IsChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
90 | 101 | </Style>
|
91 | 102 | </ToggleButton.Style>
|
92 | 103 | </ToggleButton>
|
93 |
| - |
94 | 104 | </Grid>
|
95 | 105 | </Border>
|
| 106 | + <ControlTemplate.Triggers> |
| 107 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonPosition)}" Value="Start"> |
| 108 | + <Setter TargetName="ExpanderButton" Property="Grid.Column" Value="0" /> |
| 109 | + </DataTrigger> |
| 110 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonPosition)}" Value="End"> |
| 111 | + <Setter TargetName="ExpanderButton" Property="Grid.Column" Value="2" /> |
| 112 | + </DataTrigger> |
| 113 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonPosition)}" Value="Default"> |
| 114 | + <Setter TargetName="ExpanderButton" Property="Grid.Column" Value="2" /> |
| 115 | + </DataTrigger> |
| 116 | + </ControlTemplate.Triggers> |
96 | 117 | </ControlTemplate>
|
97 | 118 | </Setter.Value>
|
98 | 119 | </Setter>
|
99 | 120 | </Style>
|
100 | 121 |
|
101 | 122 | <Style x:Key="MaterialDesignVerticalHeaderStyle" TargetType="{x:Type ToggleButton}">
|
102 | 123 | <Setter Property="Background" Value="Transparent" />
|
103 |
| - |
104 | 124 | <Setter Property="Template">
|
105 | 125 | <Setter.Value>
|
106 | 126 | <ControlTemplate TargetType="{x:Type ToggleButton}">
|
107 | 127 | <Border Padding="{Binding Path=(wpf:ExpanderAssist.VerticalHeaderPadding), RelativeSource={RelativeSource AncestorType=Expander, AncestorLevel=1}}" Background="{TemplateBinding Background}">
|
108 | 128 | <Grid>
|
109 | 129 | <Grid.RowDefinitions>
|
110 | 130 | <RowDefinition Height="Auto" />
|
111 |
| - <RowDefinition Height="16" /> |
112 | 131 | <RowDefinition Height="*" />
|
| 132 | + <RowDefinition Height="Auto" /> |
113 | 133 | </Grid.RowDefinitions>
|
114 | 134 |
|
115 | 135 | <ToggleButton x:Name="ExpanderButton"
|
116 |
| - Grid.Row="0" |
117 | 136 | VerticalAlignment="Center"
|
118 | 137 | Foreground="{TemplateBinding Foreground}"
|
119 | 138 | IsChecked="{Binding Path=IsChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
143 | 162 | </ToggleButton.Style>
|
144 | 163 | </ToggleButton>
|
145 | 164 |
|
146 |
| - <ContentPresenter Grid.Row="2" |
| 165 | + <ContentPresenter Grid.Row="1" |
147 | 166 | VerticalAlignment="Center"
|
148 | 167 | Content="{TemplateBinding Content}"
|
149 | 168 | ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
|
152 | 171 |
|
153 | 172 | </Grid>
|
154 | 173 | </Border>
|
| 174 | + <ControlTemplate.Triggers> |
| 175 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonPosition)}" Value="Start"> |
| 176 | + <Setter TargetName="ExpanderButton" Property="Grid.Row" Value="0" /> |
| 177 | + </DataTrigger> |
| 178 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonPosition)}" Value="End"> |
| 179 | + <Setter TargetName="ExpanderButton" Property="Grid.Row" Value="2" /> |
| 180 | + </DataTrigger> |
| 181 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Expander, Mode=FindAncestor}, Path=(wpf:ExpanderAssist.ExpanderButtonPosition)}" Value="Default"> |
| 182 | + <Setter TargetName="ExpanderButton" Property="Grid.Row" Value="0" /> |
| 183 | + </DataTrigger> |
| 184 | + </ControlTemplate.Triggers> |
155 | 185 | </ControlTemplate>
|
156 | 186 | </Setter.Value>
|
157 | 187 | </Setter>
|
|
0 commit comments