locked
Strike out TextBlock in Windows 8 metro apps RRS feed

  • 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.

    • Marked as answer by Min ZhuMember Thursday, December 13, 2012 6:49 AM
    • Unmarked as answer by Min ZhuMember Thursday, December 13, 2012 6:49 AM
    • Marked as answer by Roobikha Thursday, February 14, 2013 3:19 AM
    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
    Moderator

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.

    • Marked as answer by Min ZhuMember Thursday, December 13, 2012 6:49 AM
    • Unmarked as answer by Min ZhuMember Thursday, December 13, 2012 6:49 AM
    • Marked as answer by Roobikha Thursday, February 14, 2013 3:19 AM
    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
    Moderator