我在寻找一种动画故事板类型,可以让我将标签的FontWeight属性从“Normal”变为“Bold”进行动画化。有没有人有相关经验?
假设你的标签的初始字重是Normal,就像下面这样:
<Label x:Name="label" Content="Label" HorizontalAlignment="Left" FontWeight="Normal" VerticalAlignment="Top"/>
以下是可以用于将标签的字体加粗的Storyboard:
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.FontWeight)" Storyboard.TargetName="label">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<FontWeight>Bold</FontWeight>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>