Я пытаюсь использовать CommonStates
для анимации моего пользовательского элемента управления.
Я попробовал следующее:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="circle"
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
EnableDependentAnimation="True">
<LinearColorKeyFrame Value="Red"
KeyTime="0:0:0.02" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Ellipse x:Name="circle"
Height="280"
Width="280"
Fill="Green" />
</Grid>
Я могу произвести изменения, вручную вызвав UpdateStates(true)
, но при обращении к документации, участники должны запускаться автоматически.
Есть идеи, что я делаю не так?