WPF and Silverlight Edition Basic Library > HeaderedContentControl > HeaderedContentControl for WPF and Silverlight Task- Based Help > Adding Content to the Header Bar > Adding Text to the Header Bar |
By default, the C1HeaderedContentControl's header is empty. You can add text to the HeaderedContentControl's header by setting the Header property to a string in Visual Studio, in XAML, or in code.
At Design Time
To set the Header property in Visual Studio, complete the following steps:
In XAML
To set the Header property in XAML, add Header="Hello World"
to the <c1:C1HeaderedContentControl>
tag so that it appears similar to the following:
<c1:C1HeaderedContentControl Header="Hello World" Width="150" Height="55">
In Code
To set the Header property in code, complete the following steps:
x:Name="C1HeaderedContentControl_Ct"
to the <c1:C1HeaderedContentControl>
tag so that the control will have a unique identifier for you to call in code.Visual Basic
C1HeaderedContentControl_Ct.Header = "Hello World"
C#
C1HeaderedContentControl_Ct.Header = "Hello World";
Run the program.
This Topic Illustrates the following:
The header of C1HeaderedContentControl now reads "Hello World". The result of this topic should resemble the following:
Note that the content panel displays the string "C1HeaderedContentControl" by default. To learn how to add different content to the content panel, see Adding Content to the Content Panel.