为什么下面的IsSelected触发器只在代码中缺少模板Setter时才起作用?如何使两者都按预期功能运行?
我在我的Application.Resources标记中有以下内容;
我在我的Application.Resources标记中有以下内容;
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<ContentPresenter VerticalAlignment="Center"></ContentPresenter>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>