1

我正在尝试为文本块中的文本设置动画。这是我到目前为止所拥有的。

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
    <Style x:Key="TextBlockEliminated">
        <Setter Property="Control.FontSize" Value="18"/>
        <Setter Property="Control.FontWeight" Value="Bold"/>
        <Setter Property="Control.Foreground" Value="Gray"/>
        <Setter Property="TextBlock.TextDecorations">
            <Setter.Value>
                <TextDecorationCollection>
                    <TextDecoration x:Name="animatedStrikeThrough" Location="Strikethrough"/>
                </TextDecorationCollection>
            </Setter.Value>
        </Setter>
    </Style>
</Page.Resources>
<Grid>
    <TextBlock Style="{StaticResource TextBlockEliminated}">Some Text
    </TextBlock>
</Grid>


请注意,我不会在任何地方应用 DoubleAnimation,因为我不知道如何将它应用到 TextDecoration PinOffset。

4

1 回答 1

1

将两个 TextBlocks 堆叠在一起,一个带有普通文本,另一个带有删除线,但其不透明度设置为零。然后,为您的动画淡入和淡出不透明度。

于 2009-06-11T22:31:46.860 回答