Condividi tramite


DataGrid.RowGroupHeaderStyles Property

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

Gets the style that is used when rendering the row group header.

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

Syntax

'Declaration
Public ReadOnly Property RowGroupHeaderStyles As ObservableCollection(Of Style)
public ObservableCollection<Style> RowGroupHeaderStyles { get; }

Property Value

Type: System.Collections.ObjectModel.ObservableCollection<Style>
The style applied to row group headers.

Remarks

The RowGroupHeaderStyles collection can contain any number of styles. The styles are applied to successive levels of row group headers in the order in which they are defined. For example, if you define two styles, the first is applied to top level row group headers. The second style is applied to all row group headers underneath the first level. The DataContext of the DataGridRowGroupHeader is the CollectionViewGroup that the header represents.

Examples

The following example shows a RowGroupHeaderStyles collection that contains two styles. The first Style is applied to top level row groups. The second Style is applied to all row groups underneath the first level. This example is part of a larger example available in the How to: Group, Sort, and Filter Data in the DataGrid Control topic.

<sdk:DataGrid.RowGroupHeaderStyles>
    <!-- Style for groups at top level -->
    <Style TargetType="sdk:DataGridRowGroupHeader">
        <Setter Property="PropertyNameVisibility" Value="Collapsed" />
        <Setter Property="Background" Value="#FF112255" />
        <Setter Property="Foreground" Value="#FFEEEEEE" />
        <Setter Property="SublevelIndent" Value="15" />
    </Style>
    <!-- Style for groups under the top level -->
    <Style TargetType="sdk:DataGridRowGroupHeader">
        <Setter Property="Background" Value="#44225566" />
    </Style>
</sdk:DataGrid.RowGroupHeaderStyles>

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.