Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGrid.RowStyle Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the style applied to all rows.

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

public Style RowStyle { get; set; }

Property Value

Type: System.Windows.Style

The style applied to all rows in the DataGrid. The registered default is null. For more information about what can influence the value, see DependencyProperty.

Apply a Style to change the visual appearance of all rows in the DataGrid. To define a Style for a row, specify a TargetType of DataGridRow.

A Style can be applied to all rows in the DataGrid or to an individual row. To apply a Style to an individual row, set the Style property directly on the DataGridRow, which takes precedence over the DataGrid.RowStyle property.

If this property has a non-null value, it will override the value of the ItemContainerStyle property.

The following example sets the Background color of all the rows and uses a trigger to change the Background and Foreground colors when the mouse pointer is over the row.

The following illustration shows the output.

Custom DataGrid Row Style

.NET Framework
Available since 4.0
Silverlight
Available since 2.0
Return to top
Show:
© 2017 Microsoft