|
1 | 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
2 | 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
3 | | - xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"> |
| 3 | + xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf" |
| 4 | + xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters" |
| 5 | + xmlns:system="clr-namespace:System;assembly=mscorlib"> |
| 6 | + |
| 7 | + <converters:MathMultipleConverter x:Key="MathMlpMultipleConverter" Operation="Multiply" /> |
4 | 8 |
|
5 | 9 | <Style x:Key="MaterialDesignExpanderToggleButton" TargetType="{x:Type ToggleButton}"> |
6 | 10 | <Setter Property="Width" Value="16"/> |
|
102 | 106 |
|
103 | 107 | <Style x:Key="MaterialDesignExpander" TargetType="{x:Type Expander}"> |
104 | 108 | <Setter Property="Background" Value="{StaticResource MaterialDesignPaper}" /> |
| 109 | + <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/> |
105 | 110 | <Setter Property="Template"> |
106 | 111 | <Setter.Value> |
107 | 112 | <ControlTemplate TargetType="{x:Type Expander}"> |
|
117 | 122 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility"> |
118 | 123 | <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" /> |
119 | 124 | </ObjectAnimationUsingKeyFrames> |
120 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content"> |
121 | | - <EasingDoubleKeyFrame KeyTime="0" Value="0"/> |
122 | | - <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/> |
123 | | - </DoubleAnimationUsingKeyFrames> |
124 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="PART_Content"> |
125 | | - <EasingDoubleKeyFrame KeyTime="0" Value=".5"/> |
126 | | - <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/> |
127 | | - </DoubleAnimationUsingKeyFrames> |
128 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="PART_Content"> |
129 | | - <EasingDoubleKeyFrame KeyTime="0" Value="0"/> |
130 | | - <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/> |
131 | | - </DoubleAnimationUsingKeyFrames> |
| 125 | + <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" |
| 126 | + To="1" Duration="0:0:0.3"/> |
| 127 | + <DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer" |
| 128 | + To="1" Duration="0:0:0.3"/> |
132 | 129 | </Storyboard> |
133 | 130 | </VisualTransition> |
134 | 131 | <VisualTransition GeneratedDuration="0" To="Collapsed"> |
| 132 | + <VisualTransition.GeneratedEasingFunction> |
| 133 | + <CubicEase EasingMode="EaseOut"/> |
| 134 | + </VisualTransition.GeneratedEasingFunction> |
135 | 135 | <Storyboard> |
136 | 136 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility"> |
137 | | - <DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Collapsed}" /> |
| 137 | + <DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Collapsed}" /> |
138 | 138 | </ObjectAnimationUsingKeyFrames> |
139 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content"> |
140 | | - <EasingDoubleKeyFrame KeyTime="0" Value="1"/> |
141 | | - <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/> |
142 | | - </DoubleAnimationUsingKeyFrames> |
143 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="PART_Content"> |
144 | | - <EasingDoubleKeyFrame KeyTime="0" Value="1"/> |
145 | | - <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value=".5"/> |
146 | | - </DoubleAnimationUsingKeyFrames> |
147 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="PART_Content"> |
148 | | - <EasingDoubleKeyFrame KeyTime="0" Value="1"/> |
149 | | - <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/> |
150 | | - </DoubleAnimationUsingKeyFrames> |
| 139 | + <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" |
| 140 | + To="0" Duration="0:0:0.3"/> |
| 141 | + <DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer" |
| 142 | + To="0" Duration="0:0:0.3"/> |
151 | 143 | </Storyboard> |
152 | 144 | </VisualTransition> |
153 | 145 | </VisualStateGroup.Transitions> |
154 | 146 | <VisualState x:Name="Expanded"> |
155 | 147 | <Storyboard> |
156 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content"> |
157 | | - <EasingDoubleKeyFrame KeyTime="0" Value="1"/> |
158 | | - </DoubleAnimationUsingKeyFrames> |
159 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="PART_Content"> |
160 | | - <EasingDoubleKeyFrame KeyTime="0:0:0" Value="1"/> |
161 | | - </DoubleAnimationUsingKeyFrames> |
162 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="PART_Content"> |
163 | | - <EasingDoubleKeyFrame KeyTime="0:0:0" Value="1"/> |
164 | | - </DoubleAnimationUsingKeyFrames> |
| 148 | + <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" To="1" Duration="0"/> |
| 149 | + <DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer" To="1" Duration="0"/> |
165 | 150 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility"> |
166 | 151 | <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" /> |
167 | 152 | </ObjectAnimationUsingKeyFrames> |
168 | 153 | </Storyboard> |
169 | 154 | </VisualState> |
170 | 155 | <VisualState x:Name="Collapsed"> |
171 | 156 | <Storyboard> |
172 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content"> |
173 | | - <EasingDoubleKeyFrame KeyTime="0" Value="0"/> |
174 | | - </DoubleAnimationUsingKeyFrames> |
175 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="PART_Content"> |
176 | | - <EasingDoubleKeyFrame KeyTime="0:0:0" Value=".5"/> |
177 | | - </DoubleAnimationUsingKeyFrames> |
178 | | - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="PART_Content"> |
179 | | - <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/> |
180 | | - </DoubleAnimationUsingKeyFrames> |
| 157 | + <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" To="0" Duration="0"/> |
| 158 | + <DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer" To="0" Duration="0"/> |
181 | 159 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility"> |
182 | 160 | <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" /> |
183 | 161 | </ObjectAnimationUsingKeyFrames> |
|
196 | 174 | <ColumnDefinition Width="100*" /> |
197 | 175 | </Grid.ColumnDefinitions> |
198 | 176 | <ToggleButton IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
199 | | - Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource TemplatedParent}}" OverridesDefaultStyle="True" |
| 177 | + OverridesDefaultStyle="True" |
200 | 178 | Style="{StaticResource MaterialDesignExpanderToggleButton}" /> |
201 | | - <ToggleButton Grid.Column="1" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
| 179 | + <ToggleButton Grid.Column="1" |
| 180 | + IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
202 | 181 | Style="{StaticResource MaterialDesignExpanderHeaderToggleButton}"> |
203 | 182 | <ContentPresenter ContentSource="Header" HorizontalAlignment="Stretch" RecognizesAccessKey="True" VerticalAlignment="Center" /> |
204 | 183 | </ToggleButton> |
205 | 184 | </Grid> |
206 | 185 | </Border> |
207 | 186 | <Border Grid.Row="1"> |
208 | | - <ContentPresenter Name="PART_Content" RenderTransformOrigin="0,0"> |
209 | | - <ContentPresenter.LayoutTransform> |
210 | | - <TransformGroup> |
211 | | - <ScaleTransform ScaleX="0.5" ScaleY="0" /> |
212 | | - <SkewTransform /> |
213 | | - <RotateTransform /> |
214 | | - <TranslateTransform /> |
215 | | - </TransformGroup> |
216 | | - </ContentPresenter.LayoutTransform> |
217 | | - </ContentPresenter> |
| 187 | + <ScrollViewer x:Name="ItemsScrollViewer" |
| 188 | + VerticalScrollBarVisibility="Hidden"> |
| 189 | + <ScrollViewer.Tag> |
| 190 | + <system:Double>0.0</system:Double> |
| 191 | + </ScrollViewer.Tag> |
| 192 | + <ScrollViewer.Height> |
| 193 | + <MultiBinding Converter="{StaticResource MathMlpMultipleConverter}"> |
| 194 | + <Binding ElementName="PART_Content" Path="ActualHeight"/> |
| 195 | + <Binding RelativeSource="{RelativeSource Self}" Path="Tag"/> |
| 196 | + </MultiBinding> |
| 197 | + </ScrollViewer.Height> |
| 198 | + <ContentPresenter Name="PART_Content" /> |
| 199 | + </ScrollViewer> |
218 | 200 | </Border> |
219 | 201 | </Grid> |
220 | 202 | </ControlTemplate> |
|
0 commit comments