【发布时间】:2013-12-17 02:40:31
【问题描述】:
我正在尝试使用 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 类以及如何将它与 Runs 一起使用,但发现无法使用 VisualStates 来做到这一点。
有没有办法做到这一点?或任何其他方式来切换 PointerOver 上按钮内容的下划线效果?
提前致谢。
【问题讨论】: