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:
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto"/>
        <RowDefinition />
        <RowDefinition Height="Auto"/>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition />
  3. Add some controls ...

Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.