TextBlock Control in Windows Store App

In this article I describe the TextBlock Control in Windows Store Apps.

The TextBlock Control displays static (read-only) text in a Windows Store app simply by assigning the text in string format to the Text property of the TextBlock control.

<TextBlock Text="Textblock control of winodows store app"></TextBlock>

The text property of the textblock control above will simply output whatever you write in it.

Note: However a TextBlock also provides the ability to display a series of strings in a Textblock with different formatting or break the line of text by using the "Run" and "Linebreak" element.

   <TextBlock Text="Textblock control of winodows store app" Foreground="Yellow" FontSize="25" Grid.RowSpan="2">

            <LineBreak />

            <Run FontFamily="Arial" FontWeight="ExtraBold" Foreground="Red" FontSize="14">Second line text</Run>

            <LineBreak />

           <Run FontFamily="Gigi" FontSize="15" FontWeight="ExtraBold" Foreground="Blue" >Third line text</Run>   

          

        </TextBlock>

Output

textblock-output.jpg

Summary

A Textblock is just like the label control of the .Net framework. Both are used to display static text. In a Windows Store app however the label control is not available; instead of the label control, use a Textblock control.