#243 – Display Text Using a Label Control

We saw how to use the DrawText and DrawGlyphRun methods to draw text into a visual element at a very low-level.  A much easier way to display text in a user interface is to use the Label control.

Because Label inherits from UIElement, you can include it in XAML as child of a Panel control.

You set the text for the Label using its Content property.

Here are some examples of Label controls.

	<StackPanel Orientation="Vertical">
		<Label Content="Miss Barkley was quite tall."/>
		<Label Content="A man is never lost at sea." FontFamily="Verdana" FontSize="16" FontWeight="Bold"/>
		<Label Content="Listen, Robert, going to another country doesn't make any difference." Foreground="Blue" Background="Pink"/>


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: