GridViewColumn.Header Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the content of the header of a GridViewColumn.
public:
property System::Object ^ Header { System::Object ^ get(); void set(System::Object ^ value); };
public object Header { get; set; }
member this.Header : obj with get, set
Public Property Header As Object
Property Value
The object to use for the column header. The default is null
.
Remarks
The Header property can be set to an object that is as simple as a string
, or to an object that is as complex as a StackPanel that has embedded content. The default column header in a GridView view mode is styled as a button that is derived from ButtonBase and that has the content of the Header property as its child. To specify a template for the column header, see the HeaderTemplate or HeaderTemplateSelector property descriptions.
Properties that define the content, layout, and style of a column header are found on many related classes, and some of these properties have functionality that is similar or the same. For more information, see GridView Column Header Styles and Templates Overview.
Dependency Property Information
Identifier field | HeaderProperty |
Metadata properties set to true |
None |
XAML Attribute Usage
<object Header="string"/>
XAML Property Element Usage
<object>
<HeaderContentObject.../>
</object>
XAML Values
<HeaderContentObject.../>
A single element. This element can have child elements if the HeaderContentObject content model allows them.
Example
The following example shows how to set the Header property.
GridViewColumn gvc1 = new GridViewColumn();
gvc1.DisplayMemberBinding = new Binding("FirstName");
gvc1.Header = "FirstName";
gvc1.Width = 100;
Dim gvc1 As New GridViewColumn()
gvc1.DisplayMemberBinding = New Binding("FirstName")
gvc1.Header = "FirstName"
gvc1.Width = 100
<GridViewColumn DisplayMemberBinding=
"{Binding Path=FirstName}"
Header="First Name" Width="100"/>