|
155 | 155 | <ControlTemplate>
|
156 | 156 | <ControlTemplate.Resources>
|
157 | 157 | <CircleEase x:Key="UnderlineEasingFunction" EasingMode="EaseOut"/>
|
158 |
| - <Storyboard x:Key="ExpandUnderlineBorderStoryboard"> |
159 |
| - <DoubleAnimation Storyboard.TargetName="UnderlineBorder" |
160 |
| - Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" |
161 |
| - Duration="0:0:0.3" |
162 |
| - EasingFunction="{StaticResource UnderlineEasingFunction}" |
163 |
| - To="1"/> |
164 |
| - </Storyboard> |
165 |
| - <Storyboard x:Key="CollapseUnderlineBorderStoryboard"> |
166 |
| - <DoubleAnimation Storyboard.TargetName="UnderlineBorder" |
167 |
| - Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" |
168 |
| - Duration="0:0:0.3" |
169 |
| - EasingFunction="{StaticResource UnderlineEasingFunction}" |
170 |
| - To="0"/> |
171 |
| - </Storyboard> |
172 | 158 | </ControlTemplate.Resources>
|
173 | 159 | <Border x:Name="UnderlineBorder"
|
174 | 160 | Background="{TemplateBinding Background}"
|
|
178 | 164 | HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
179 | 165 | SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
180 | 166 | RenderTransformOrigin="0.5,0.5">
|
| 167 | + <VisualStateManager.VisualStateGroups> |
| 168 | + <VisualStateGroup x:Name="ActivationStates"> |
| 169 | + <VisualStateGroup.Transitions> |
| 170 | + <VisualTransition From="Inactive" To="Active"> |
| 171 | + <Storyboard> |
| 172 | + <DoubleAnimation Storyboard.TargetName="ScaleTransform" |
| 173 | + Storyboard.TargetProperty="ScaleX" |
| 174 | + Duration="0:0:0.3" |
| 175 | + EasingFunction="{StaticResource UnderlineEasingFunction}" |
| 176 | + To="1"/> |
| 177 | + </Storyboard> |
| 178 | + </VisualTransition> |
| 179 | + <VisualTransition From="Active" To="Inactive"> |
| 180 | + <Storyboard> |
| 181 | + <DoubleAnimation Storyboard.TargetName="ScaleTransform" |
| 182 | + Storyboard.TargetProperty="ScaleX" |
| 183 | + Duration="0:0:0.3" |
| 184 | + EasingFunction="{StaticResource UnderlineEasingFunction}" |
| 185 | + To="0"/> |
| 186 | + </Storyboard> |
| 187 | + </VisualTransition> |
| 188 | + </VisualStateGroup.Transitions> |
| 189 | + <VisualState x:Name="Active"> |
| 190 | + <Storyboard> |
| 191 | + <DoubleAnimation Storyboard.TargetName="ScaleTransform" |
| 192 | + Storyboard.TargetProperty="ScaleX" |
| 193 | + Duration="0" |
| 194 | + To="1"/> |
| 195 | + </Storyboard> |
| 196 | + </VisualState> |
| 197 | + <VisualState x:Name="Inactive"> |
| 198 | + <Storyboard> |
| 199 | + <DoubleAnimation Storyboard.TargetName="ScaleTransform" |
| 200 | + Storyboard.TargetProperty="ScaleX" |
| 201 | + Duration="0" |
| 202 | + To="0"/> |
| 203 | + </Storyboard> |
| 204 | + </VisualState> |
| 205 | + </VisualStateGroup> |
| 206 | + </VisualStateManager.VisualStateGroups> |
181 | 207 | <Border.RenderTransform>
|
182 |
| - <ScaleTransform ScaleX="0" ScaleY="1"/> |
| 208 | + <ScaleTransform ScaleX="0" ScaleY="1" x:Name="ScaleTransform" /> |
183 | 209 | </Border.RenderTransform>
|
184 | 210 | </Border>
|
185 |
| - <ControlTemplate.Triggers> |
186 |
| - <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsActive}" Value="True"> |
187 |
| - <DataTrigger.EnterActions> |
188 |
| - <BeginStoryboard Storyboard="{StaticResource ExpandUnderlineBorderStoryboard}"/> |
189 |
| - </DataTrigger.EnterActions> |
190 |
| - <DataTrigger.ExitActions> |
191 |
| - <BeginStoryboard Storyboard="{StaticResource CollapseUnderlineBorderStoryboard}"/> |
192 |
| - </DataTrigger.ExitActions> |
193 |
| - </DataTrigger> |
194 |
| - </ControlTemplate.Triggers> |
195 | 211 | </ControlTemplate>
|
196 | 212 | </Setter.Value>
|
197 | 213 | </Setter>
|
|
0 commit comments