【问题标题】:Changing color of specific Row in Telerik UWP RadDataGrid在 Telerik UWP RadDataGrid 中更改特定行的颜色
【发布时间】:2019-02-22 00:42:22
【问题描述】:

我认为有以下 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 属性根据特定条件返回红色。

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

我怎样才能做到这一点?

【问题讨论】:

    标签: c# xaml uwp telerik telerik-grid


    【解决方案1】:

    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>
    

    【讨论】:

      猜你喜欢
      • 2012-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-22
      • 1970-01-01
      相关资源
      最近更新 更多