如果选择了行的一个单元格,则DataGrid行边框会更改

时间:2013-12-20 13:06:37

标签: c# wpf datagrid

我有一个DataGrid.RowStyle,当IsKeyboardFocusWithin属性为true时,它会更改BorderBrush和BorderThickness。

<DataGrid.RowStyle>
 <Style TargetType="{x:Type DataGridRow}">
  <Style.Triggers>
   <Trigger Property="IsKeyboardFocusWithin" Value="True">
    <Setter Property="BorderBrush" Value="#FFFB1818"/>
    <Setter Property="BorderThickness" Value="0,1.5"/>
   </Trigger>
  </Style.Triggers>
 </Style
</DataGrid.RowStyle>

所以它只是工作,但现在我想要更改行的边框,如果选择了行的单元格。我可以更改程序中的selectedcell,所以我只需要一个样式,因为我不会用键盘/鼠标聚焦选定的单元格。但我没有看到如何设置触发器。是否有SomeCellIsSelected - DataGridRow中的属性?

请注意我在WPF中使用数据网格而不是数据网格视图!

1 个答案:

答案 0 :(得分:0)

在评论中聊天后,icebat得到this link,这是有效的。