Once the project gets created, follow these simple steps to add text in your application UI, using the Label control:
- Open the MainWindow.xaml file to change the application UI.
- Replace the existing Grid panel with the following XAML code:
<StackPanel Margin="10 10 10 20"> <Label Content="1. This is a Label control" /> <Label Content="2. A Label control with text formatting" FontWeight="Bold" Foreground="Red" FontStyle="Italic"/> <Label> <StackPanel Orientation="Horizontal"> <TextBlock Text="3. A Rectangle" /> <Rectangle Width="20" Height="20" Fill="Red"
Margin="10 0" /> <TextBlock Text="inside a Label control" /> </StackPanel> </Label> </StackPanel>
- Now build...