tags:

views:

124

answers:

1

I am trying to animate the line that strikes through text in a textblock. Here is what I have so far.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
<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>


Notice I do not Appy a DoubleAnimation anywhere thats because I cant figure out how to apply it to the TextDecoration PinOffset.

A: 

Have two TextBlocks stacked on top of each other, one with normal text, and the other with the strikeout applied, but its Opacity set to zero. Then, fade the opacity in and out for your animation.

Paul Betts