DataGrid.RowHeaderStyle Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the style that is used when rendering the row headers.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
Public Property RowHeaderStyle As Style
public Style RowHeaderStyle { get; set; }
<sdk:DataGrid>
  <sdk:DataGrid.RowHeaderStyle>
    inlineStyle
  </sdk:DataGrid.RowHeaderStyle>
</sdk:DataGrid>
<sdk:DataGrid RowHeaderStyle="styleReference"/>

XAML Values

Whether defined as an inline style or as a resource, the Style defines the appearance of the row header area in the data grid, and should specify a TargetType of DataGridRowHeader. You typically would specify setters for individual properties, and might also use a setter for the Template property if you wanted to change the composition of elements. For information that can help you decide whether to define styles inline or as resources, see Inline Styles and Templates.

Property Value

Type: System.Windows.Style
The style applied to row headers. The default is nulla null reference (Nothing in Visual Basic).

Remarks

Dependency property identifier field: RowHeaderStyleProperty

The DataGridRowHeader type is located in the System.Windows.Controls.Primitives namespace, in the System.Windows.Controls.Data assembly. Because of this, to set the TargetType property for a Style, you will have to add a XAML namespace mapping in your code.

Examples

The following example shows how to set the RowHeaderStyle property.

<sdk:DataGrid x:Name="DG" ItemsSource="{Binding}" HeadersVisibility="All" >


...


                <sdk:DataGrid.RowHeaderStyle>
                <Style  TargetType="sdk:DataGridRowHeader" >
                    <Setter Property="Background" Value="LightGray" />
                    <Setter Property="SeparatorVisibility" Value="Visible" />
                    <Setter Property="SeparatorBrush" Value="LightBlue" />
                    <Setter Property="FontWeight" Value="Bold" />
                    <Setter Property="FontSize" Value="12" />
                </Style>
            </sdk:DataGrid.RowHeaderStyle>



...



</sdk:DataGrid>

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.