更改 Telerik UWP RadDataGrid 中特定行的颜色

Changing color of specific Row in Telerik UWP RadDataGrid

我认为 XAML:

<tg:RadDataGrid ColumnDataOperationsMode="Flyout"  x:Name="grid3" ItemsSource="{x:Bind ViewModel.MappingSource}" SelectedItem="{x:Bind ViewModel.CurrentMapping, Mode=TwoWay}" UserEditMode="{x:Bind ViewModel.CanEdit, Mode=TwoWay}"  Grid.ColumnSpan="4" Grid.Row="1" AutoGenerateColumns="False" RowBackground="{x:Bind ViewModel.ValidateModBank}">

请查看设置 RowBackground 属性 的行尾。此时我的 ValidateModBank 属性 returns 颜色是红色的,基于一定的标准。

问题是 RadDataGrid 中的所有行都变为红色,但我只想更改特定行 - 基于 ValidateModBank

我怎样才能做到这一点?

RowBackground属性是用来设置定义每一行填充的Brush,不是针对特定行的。

根据您的描述,您可能需要更改所选行的背景。

您可以使用其 Implicit Styling

正在为其设置 SelectionRegionBackground Control

<telerikGrid:RadDataGrid.Resources>
    <Style TargetType="gridPrimitives:SelectionRegionBackgroundControl">
        <Setter Property="Background" Value="Red"/>
        <Setter Property="BorderBrush" Value="Green"/>
        <Setter Property="BorderThickness" Value="2"/>
    </Style>
</telerikGrid:RadDataGrid.Resources>