locked
Strike out TextBlock in Windows 8 metro apps

    Question

  • Is it possible to strike through the Text in a TextBlock? I am able to strike through the selected text in a RichEditBox using "CharacterFormat". How can I use CharcaterFormat for striking through the text in a TextBlock?
    Tuesday, December 11, 2012 8:04 AM

Answers

  • Hi,

    As far as I know, there is no directly way to do this.
    Maybe we can try this way.

     <Grid Height="30">
            <TextBlock Text="This is a test" FontSize="22" Height="34" HorizontalAlignment="Center" Foreground="White"   />
            <Line Stretch="Fill" Stroke="white" StrokeThickness="2 " X1="1" Width="120" VerticalAlignment="Center"  HorizontalAlignment="Center"   />
        </Grid>

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 13, 2012 6:21 AM
  • There is no direct way to strike-through a TextBlock. The CharacterFormat is specific to the RichEditBox.

    Depending on your specific needs you may be able to fake this by drawing a line on top of the TextBlock.

    --Rob

    Thursday, December 13, 2012 6:37 AM
    Owner

All replies

  • Hi,

    As far as I know, there is no directly way to do this.
    Maybe we can try this way.

     <Grid Height="30">
            <TextBlock Text="This is a test" FontSize="22" Height="34" HorizontalAlignment="Center" Foreground="White"   />
            <Line Stretch="Fill" Stroke="white" StrokeThickness="2 " X1="1" Width="120" VerticalAlignment="Center"  HorizontalAlignment="Center"   />
        </Grid>

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 13, 2012 6:21 AM
  • There is no direct way to strike-through a TextBlock. The CharacterFormat is specific to the RichEditBox.

    Depending on your specific needs you may be able to fake this by drawing a line on top of the TextBlock.

    --Rob

    Thursday, December 13, 2012 6:37 AM
    Owner