简体   繁体   English

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

[英]DataGrid Row Border change if one cell of the row is selected

I have a DataGrid.RowStyle, who changes the BorderBrush and BorderThickness, when the IsKeyboardFocusWithin property is true. 我有一个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>

So its just work, but now i want to change the border of the row, if a cell of the row is selected. 所以它只是工作,但现在我想更改行的边框,如果选择了行的单元格。 I can change the selectedcell in the program so i just need a style for this, because i dont focus the selected cell with the Keyboard/Mouse. 我可以在程序中更改selectedcell,所以我只需要一种样式,因为我不将所选单元格放在键盘/鼠标上。 But i dont see how to set the Trigger. 但是我看不到如何设置触发器。 Is there something like SomeCellIsSelected -Property in the DataGridRow ? DataGridRow中是否有类似SomeCellIsSelected -Property的内容?

Pls note that i use a datagrid in WPF not a datagridview! 请注意,我在WPF使用datagrid而不是datagridview!

在评论中聊天之后,icebat得到了此链接该链接正在工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM