我正在尝试使用VisualStates强调按钮的内容,但我没有这样做。
理想情况下,我喜欢这样做,就像我可以更改内容的FontWeight一样,
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="FontWeight" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="Bold"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
但以下内容无效,
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="FontStyle" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="Underline"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
我已经阅读了关于Underline类以及如何在运行中使用它但是没有办法使用VisualStates这样做。
有没有办法做到这一点?或者任何其他方式在PointerOver上切换按钮内容的带下划线的效果?
提前致谢。
答案 0 :(得分:-1)
“但以下是抛出异常”并没有帮助。知道WHICH Exception和WHICH错误消息可能会有所帮助。
但是,要强调某些内容,您不要将“FontStyle”设置为“TextDecorations”,而应将其设置为“Underline”