PointerOver上的下划线按钮内容

时间:2013-12-17 02:40:32

标签: xaml windows-store-apps

我正在尝试使用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上切换按钮内容的带下划线的效果?

提前致谢。

1 个答案:

答案 0 :(得分:-1)

“但以下是抛出异常”并没有帮助。知道WHICH Exception和WHICH错误消息可能会有所帮助。

但是,要强调某些内容,您不要将“FontStyle”设置为“TextDecorations”,而应将其设置为“Underline”

相关问题