我試圖覆蓋一個按鈕,而不是phoneAccentColor 的背景顏色我寫這樣Phone8如何點擊
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="FontSize" Value="25"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Light"/>
<Setter Property="Height" Value="75"/>
<Setter Property="Width" Value="440"/>
<Setter Property="Background" Value="{StaticResource blueBackground}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource blueBackground}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="White"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
在App.xaml中的樣式代碼,現在我不能甚至可以看到按鈕時更改按鈕的背景顏色如果我沒有點擊 我該如何改變它
這類似的問題,可以幫助http://stackoverflow.com/questions/14029690/wp7-blinking-background-in-custom-button/14158572#14158572 – 2013-03-15 12:54:29