그러나 Style.Triggers는 UWP를 지원하지 않습니다.
네 말이 맞습니다. UWP에서는 내장 된 VisualStateManager을 사용해야합니다.
어떻게 메뉴를 구현했는지 모르겠지만 마우스를 올리거나 누르거나 다른 상태가되면 Button
의 배경을 변경하려면 버튼 default template style을 수정할 수 있습니다.
<Button Content="Button 1" Style="{StaticResource ButtonStyle}" />
:
다음
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
<DiscreteObjectKeyFrame KeyTime="0" Value="Red" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
</Storyboard>
</VisualState>
당신이 StaticResource
이 같은 예를 들어,이 스타일의 키를 사용하여이 템플릿을 적용 할 수 있습니다 :이 같은 PointerOver
명명 된 VisualState
수정