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:
- Create a new WPF application named
CH04.TextControls
. - Open
MainWindow.xaml
. Add four rows and two columns to the existingGrid
:<Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto"/> <RowDefinition /> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition /> </Grid.ColumnDefinitions>
- 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.