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 help me?
source share