C# 绑定不适用于错误验证

C# 绑定不适用于错误验证,c#,.net,wpf,wpf-controls,C#,.net,Wpf,Wpf Controls,我有控件验证错误的样式。我在工具提示中显示错误,我还想在控件旁边的文本块中显示错误。工具提示中的绑定可以正常工作,但不能与文本块一起工作。我尝试在文本块中硬编码一些文本,但绑定不起作用 <Style TargetType="{x:Type Control}" x:Key="S_ErrorTemplate"> <Setter Property="Validation.ErrorTemplate"> <Setter.Value>

我有控件验证错误的样式。我在工具提示中显示错误,我还想在控件旁边的文本块中显示错误。工具提示中的绑定可以正常工作,但不能与文本块一起工作。我尝试在文本块中硬编码一些文本,但绑定不起作用

 <Style TargetType="{x:Type Control}" x:Key="S_ErrorTemplate">
    <Setter Property="Validation.ErrorTemplate">
        <Setter.Value>
            <ControlTemplate>
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Right" Foreground="Red" 
                      FontSize="12pt" 
                    Text="{Binding Path=(Validation.Errors)[0].ErrorContent,
                           RelativeSource={RelativeSource TemplatedParent}}" />
                    <Border BorderBrush="Green" BorderThickness="1" >
                        <AdornedElementPlaceholder Name="myControl"/>
                    </Border>
                </DockPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Style.Triggers>
        <Trigger Property="Validation.HasError" Value="true">
            <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self},
            Path=(Validation.Errors)[0].ErrorContent}"/>
            <Setter Property="Background" Value="Maroon"/>
        </Trigger>
    </Style.Triggers>
</Style>


我认为问题在于ErrorContent属性的类型,它显示的是类型对象和所需的文本,我认为字符串,所以尝试将ErrorContent转换为绑定中的字符串同样适用于工具提示绑定,但不适用于文本块。