Search This Blog

Wednesday, July 6, 2016

TextBlock WPF Example

WPF > Controls  > TextBlock 

TextBlock can contain a string in its Text property.

TextBlock is designed to be lightweight and is optimized for single-line display.

Example


<Window x:Class="TextBlock.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TextBlock Name="textBlock1" TextWrapping="Wrap">
            Simple text <Bold>Bold text</Bold> <Italic>Italic text</Italic>
        </TextBlock>
    </Grid>

</Window>