C# 自定义DataGridRowHeader样式的默认ValidationErrorTemplate
我遇到了这个问题,并用synergetic的答案的修改版本解决了它。所以我的风格是这样的:C# 自定义DataGridRowHeader样式的默认ValidationErrorTemplate,c#,wpf,xaml,datagrid,styles,C#,Wpf,Xaml,Datagrid,Styles,我遇到了这个问题,并用synergetic的答案的修改版本解决了它。所以我的风格是这样的: <Style x:Key="{x:Type DataGridRowHeader}" TargetType="{x:Type DataGridRowHeader}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate>
<Style x:Key="{x:Type DataGridRowHeader}" TargetType="{x:Type DataGridRowHeader}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Control SnapsToDevicePixels="true"
Visibility="{Binding RelativeSource={RelativeSource
AncestorType={x:Type DataGridRow}},
Path=Item.HasErrors, Converter={StaticResource
BooleanToVisibilityConverter}}"
Template="{Binding RelativeSource={RelativeSource
AncestorType={x:Type DataGridRow}},
Path=ValidationErrorTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
它工作得很好,但是不再以默认样式显示DataGridRowHeader
,尽管(据我所知)默认样式是通过ValidationErrorTemplate
引用的
比较
(添加上述样式后)使用
这是我想要实现的
你知道我需要做什么改变才能得到那种诽谤的风格吗?我没有主意了。没人有主意吗(好吧,我放弃了,以其他方式解决了它。没有人有主意?:(好吧,我放弃了,以其他方式解决了它。