DataGrid.RowStyle 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 style applied to all rows.
public:
property System::Windows::Style ^ RowStyle { System::Windows::Style ^ get(); void set(System::Windows::Style ^ value); };
public System.Windows.Style RowStyle { get; set; }
member this.RowStyle : System.Windows.Style with get, set
Public Property RowStyle As Style
Property Value
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.
Examples
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.
<DataGrid Name="dataGrid1" Margin="12,12,0,0">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="LightBlue" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Blue"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
The following illustration shows the output.
Remarks
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.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기