当一个双赢8地铁控制编写自定义的ControlTemplate(XAML),我们需要使用VisualStateManager根据的VisualState过渡到更新控制。 我看到了下面的示例遍MSDN,但我找不到其中VisualStateGroup“CommonStates”是记录和其他什么VisualStates的定义比“PointerOver”和“正常”之外? 你必须去挖掘在SDK中找到一个按钮的默认控件模板? 如果是这样,在哪里?
<ControlTemplate TargetType="Button">
<Grid >
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<!--Take one half second to transition to the PointerOver state.-->
<VisualTransition To="PointerOver"
GeneratedDuration="0:0:0.5"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<!--Change the SolidColorBrush, ButtonBrush, to red when the
Pointer is over the button.-->
<VisualState x:Name="PointerOver">
<Storyboard>
<ColorAnimation Storyboard.TargetName="ButtonBrush"
Storyboard.TargetProperty="Color" To="Red" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.Background>
<SolidColorBrush x:Name="ButtonBrush" Color="Green"/>
</Grid.Background>
</Grid>
</ControlTemplate>