Skip to content

Commit dfce5ae

Browse files
committed
improve transitions MaterialDesignFlatToggleButton #73
1 parent c575b2d commit dfce5ae

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ToggleButton.xaml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -200,28 +200,46 @@
200200
</VisualState>
201201
</VisualStateGroup>
202202
<VisualStateGroup x:Name="CheckStates">
203+
<VisualStateGroup.Transitions>
204+
<VisualTransition From="*" To="Checked">
205+
<Storyboard>
206+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Width)" Storyboard.TargetName="CheckedEllipse">
207+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
208+
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.1" />
209+
</DoubleAnimationUsingKeyFrames>
210+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Height)" Storyboard.TargetName="CheckedEllipse">
211+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
212+
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.1" />
213+
</DoubleAnimationUsingKeyFrames>
214+
</Storyboard>
215+
</VisualTransition>
216+
<VisualTransition From="Checked" To="Unchecked">
217+
<Storyboard>
218+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Width)" Storyboard.TargetName="CheckedEllipse">
219+
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.0" />
220+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
221+
</DoubleAnimationUsingKeyFrames>
222+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Height)" Storyboard.TargetName="CheckedEllipse">
223+
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.0" />
224+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
225+
</DoubleAnimationUsingKeyFrames>
226+
</Storyboard>
227+
</VisualTransition>
228+
</VisualStateGroup.Transitions>
203229
<VisualState x:Name="Checked">
204230
<Storyboard>
205-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Width)" Storyboard.TargetName="CheckedEllipse">
206-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
207-
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.1" />
208-
</DoubleAnimationUsingKeyFrames>
209-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Height)" Storyboard.TargetName="CheckedEllipse">
210-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
211-
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.1" />
212-
</DoubleAnimationUsingKeyFrames>
231+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="(Control.Width)" Storyboard.TargetName="CheckedEllipse"
232+
To="40" />
233+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="(Control.Height)" Storyboard.TargetName="CheckedEllipse"
234+
To="40" />
213235
</Storyboard>
214236
</VisualState>
215237
<VisualState x:Name="Unchecked">
216238
<Storyboard>
217-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Width)" Storyboard.TargetName="CheckedEllipse">
218-
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.0" />
219-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
220-
</DoubleAnimationUsingKeyFrames>
221-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="(Control.Height)" Storyboard.TargetName="CheckedEllipse">
222-
<LinearDoubleKeyFrame Value="40" KeyTime="0:0:0.0" />
223-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
224-
</DoubleAnimationUsingKeyFrames>
239+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="(Control.Width)" Storyboard.TargetName="CheckedEllipse"
240+
To="0" />
241+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="(Control.Height)" Storyboard.TargetName="CheckedEllipse"
242+
To="0" />
225243
</Storyboard>
226244
</VisualState>
227245
</VisualStateGroup>

0 commit comments

Comments
 (0)