有没有办法DataGrid在焦点丢失时保留行的原始背景颜色?
我知道InactiveSelectionHighlightBrushKey可以设置一个特定的颜色,但可以说以前的背景颜色可能是红色或绿色,我想InactiveSelectionHighlightBrushKey 成为该行的原始颜色是什么?
添加:
我在viewmodel中有IsZero属性,它是true/false,以及下面的XAML:
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsZero}" Value="True">
<Setter Property="Background" Value="Green" />
</DataTrigger>
Run Code Online (Sandbox Code Playgroud)
其他行具有其他绑定以设置不同的颜色,但选择它并取消选择它会产生蓝色和灰色.我可以设置颜色,但不确定将其设置为"当前背景颜色"的优雅方式.
| 归档时间: |
|
| 查看次数: |
4180 次 |
| 最近记录: |