0
我嘗試使用visual sate manager更改按鈕前景色,但它根本不起作用。在uwp中使用VisualStateManager更改按鈕前景
<Button x:Name="Close" HorizontalAlignment="Stretch"
Width="100" Background="#FF4F4F4F"
Height="50" BorderThickness="2" BorderBrush="#FF2F2F2F"
Content="Cancel">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Close"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="#FFFFFFFF" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Close"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="#FFFFFFFF" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Button>
請幫我這個工作。
在此先感謝。
請問如果在控件模板做它,而不是它的工作? – Gui