我在网格中有一个BindingGroup:
<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>
...我的网格有一个ErrorTemplate:
<ControlTemplate x:Key="BindingGroupШаблОш">
<Border BorderBrush="Blue" BorderThickness="2">
<StackPanel>
<Label Content="My BindingGroup Error should be here!"></Label>
<AdornedElementPlaceholder />
</StackPanel>
</Border>
</ControlTemplate>我想从我的ControlTemplate访问Validation.Errors.ErrorContent,以便在我的标签中显示它。有可能吗?你能帮帮我吗?
发布于 2013-05-31 07:48:31
试一试
<ControlTemplate x:Key="BindingGroupШаблОш">
<Border BorderBrush="Blue" BorderThickness="2">
<StackPanel>
<Label Content="{Binding Path=[0].ErrorContent}"></Label>
<AdornedElementPlaceholder />
</StackPanel>
</Border>
</ControlTemplate>https://stackoverflow.com/questions/16847308
复制相似问题