-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
MaterialDesignTheme.Flipper.xaml
191 lines (186 loc) · 16.4 KB
/
MaterialDesignTheme.Flipper.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf">
<SineEase x:Key="FlipEase" EasingMode="EaseInOut" />
<Style TargetType="{x:Type wpf:Flipper}">
<Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type wpf:Flipper}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
x:Name="Border">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="FlipStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Unflipped" To="Flipped">
<Storyboard FillBehavior="HoldEnd">
<DoubleAnimationUsingKeyFrames Duration="0:0:0.4" Storyboard.TargetProperty="RotationY" Storyboard.TargetName="Plane3D">
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.0" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="-90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.4" EasingFunction="{StaticResource FlipEase}" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
<VisualTransition From="Flipped" To="Unflipped">
<Storyboard FillBehavior="HoldEnd">
<DoubleAnimationUsingKeyFrames Duration="0:0:0.4" Storyboard.TargetProperty="RotationY" Storyboard.TargetName="Plane3D">
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.0" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="-90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.4" EasingFunction="{StaticResource FlipEase}" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Unflipped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Flipped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<wpf:Plane3D x:Name="Plane3D" RotationY="0" ZFactor="2.055">
<Grid>
<ContentPresenter
x:Name="FrontContentPresenter"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding FrontContent}"
ContentTemplate="{TemplateBinding FrontContentTemplate}"
ContentTemplateSelector="{TemplateBinding FrontContentTemplateSelector}"
ContentStringFormat="{TemplateBinding FrontContentStringFormat}"
RenderTransformOrigin=".5,.5" />
<ContentPresenter
x:Name="BackContentPresenter"
Visibility="Hidden"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding BackContent}"
ContentTemplate="{TemplateBinding BackContentTemplate}"
ContentTemplateSelector="{TemplateBinding BackContentTemplateSelector}"
ContentStringFormat="{TemplateBinding BackContentStringFormat}"
RenderTransformOrigin=".5,.5" />
</Grid>
</wpf:Plane3D>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MaterialDesignCardFlipper" TargetType="{x:Type wpf:Flipper}" BasedOn="{StaticResource {x:Type wpf:Flipper}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type wpf:Flipper}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
x:Name="Border">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="FlipStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Unflipped" To="Flipped">
<Storyboard FillBehavior="HoldEnd">
<DoubleAnimationUsingKeyFrames Duration="0:0:0.4" Storyboard.TargetProperty="RotationY" Storyboard.TargetName="PART_Plane3D">
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.0" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="-90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.4" EasingFunction="{StaticResource FlipEase}" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
<VisualTransition From="Flipped" To="Unflipped">
<Storyboard FillBehavior="HoldEnd">
<DoubleAnimationUsingKeyFrames Duration="0:0:0.4" Storyboard.TargetProperty="RotationY" Storyboard.TargetName="PART_Plane3D">
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.0" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="-90" KeyTime="0:0:0.2" EasingFunction="{StaticResource FlipEase}" />
<EasingDoubleKeyFrame Value="0" KeyTime="0:0:0.4" EasingFunction="{StaticResource FlipEase}" />
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0:0:0.2" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Unflipped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Flipped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="BackContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FrontContentPresenter">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<wpf:Plane3D x:Name="PART_Plane3D" RotationY="0" ZFactor="2.055">
<wpf:Card wpf:ShadowAssist.ShadowDepth="{TemplateBinding wpf:ShadowAssist.ShadowDepth}">
<Grid>
<ContentPresenter x:Name="FrontContentPresenter"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding FrontContent}"
ContentTemplate="{TemplateBinding FrontContentTemplate}"
ContentTemplateSelector="{TemplateBinding FrontContentTemplateSelector}"
ContentStringFormat="{TemplateBinding FrontContentStringFormat}"
RenderTransformOrigin=".5,.5" />
<ContentPresenter x:Name="BackContentPresenter"
Visibility="Collapsed"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding BackContent}"
ContentTemplate="{TemplateBinding BackContentTemplate}"
ContentTemplateSelector="{TemplateBinding BackContentTemplateSelector}"
ContentStringFormat="{TemplateBinding BackContentStringFormat}"
RenderTransformOrigin=".5,.5" />
</Grid>
</wpf:Card>
</wpf:Plane3D>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>