I have a BindingGroup in a grid:
<Grid x:Name="участнКонтейн" DataContext="{Binding Source={StaticResource участнПк}}"
Grid.RowSpan="1" Grid.Row="1" HorizontalAlignment="Center">
<Grid.BindingGroup>
<BindingGroup NotifyOnValidationError="True">
<BindingGroup.ValidationRules>
<цл:валидУчастн ValidationStep="ConvertedProposedValue" />
</BindingGroup.ValidationRules>
</BindingGroup>
</Grid.BindingGroup>
<Grid.Style>
<Style>
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource BindingGroupШаблОш}" />
</Style>
</Grid.Style>
...
And I have an ErrorTemplate for my Grid:
<ControlTemplate x:Key="BindingGroupШаблОш">
<Border BorderBrush="Blue" BorderThickness="2">
<StackPanel>
<Label Content="My BindingGroup Error should be here!"></Label>
<AdornedElementPlaceholder />
</StackPanel>
</Border>
</ControlTemplate>
I want to access Validation.Errors[0].ErrorContent from my ControlTemplate to display it in my Label. Is it possible? Could you please help me?
Try
<ControlTemplate x:Key="BindingGroupШаблОш">
<Border BorderBrush="Blue" BorderThickness="2">
<StackPanel>
<Label Content="{Binding Path=[0].ErrorContent}"></Label>
<AdornedElementPlaceholder />
</StackPanel>
</Border>
</ControlTemplate>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With