mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix<DataGrid>:修复 DataGrid 在失去焦点之后单元格颜色变化问题,现在选中行失去焦点后仍然高亮
This commit is contained in:
parent
47c70669cd
commit
81ebf0cdf1
1 changed files with 17 additions and 5 deletions
|
@ -3,6 +3,22 @@
|
||||||
|
|
||||||
<Style x:Key="Style.DataGridCell" TargetType="{x:Type DataGridCell}">
|
<Style x:Key="Style.DataGridCell" TargetType="{x:Type DataGridCell}">
|
||||||
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="true">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||||
|
</Trigger>
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True" />
|
||||||
|
<Condition Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" Value="False" />
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
|
||||||
|
</MultiDataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="Style.DataGridRow" TargetType="{x:Type DataGridRow}">
|
<Style x:Key="Style.DataGridRow" TargetType="{x:Type DataGridRow}">
|
||||||
|
@ -16,10 +32,6 @@
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="{x:Type DataGrid}">
|
<Style TargetType="{x:Type DataGrid}">
|
||||||
<Style.Resources>
|
|
||||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="{x:Static SystemColors.HighlightColor}"/>
|
|
||||||
</Style.Resources>
|
|
||||||
|
|
||||||
<Setter Property="IsReadOnly" Value="True"/>
|
<Setter Property="IsReadOnly" Value="True"/>
|
||||||
<Setter Property="AutoGenerateColumns" Value="False"/>
|
<Setter Property="AutoGenerateColumns" Value="False"/>
|
||||||
<Setter Property="CanUserAddRows" Value="False"/>
|
<Setter Property="CanUserAddRows" Value="False"/>
|
||||||
|
|
Loading…
Reference in a new issue