O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with text

Text is the most fundamental way of conveying and inputting information. WPF provides a bunch of elements and controls that allow text display and input.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create a simple application that uses the more common text related controls to demonstrate their usage:

  1. Create a new WPF application named CH04.TextControls.
  2. Open MainWindow.xaml. Add four rows and two columns to the existing Grid:
    <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="Auto"/>
    <RowDefinition />
    <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition />
    </Grid.ColumnDefinitions>
    
  3. Add some controls ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required