Validation.ValidationAdornerSiteFor 附加属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置元素,此元素似乎为其指示发生了错误。
see GetValidationAdornerSiteFor, and SetValidationAdornerSiteFor
	see GetValidationAdornerSiteFor, and SetValidationAdornerSiteFor
	see GetValidationAdornerSiteFor, and SetValidationAdornerSiteFor
	示例
以下示例使用 Label 作为装饰器站点,用于对 中 ItemsControl项发生的验证错误。 该示例将 中ItemContainerStyle每个项容器的 设置为 Validation.ValidationAdornerSite 标签。 该示例使用 Validation.ValidationAdornerSiteFor 属性获取具有 错误的项容器,并将 的 Label 绑定到Content报告的第一个 ValidationError 。
<ItemsControl Name="customerList"  ItemTemplate="{StaticResource ItemTemplate}"
              ItemsSource="{Binding}">
  <ItemsControl.ItemBindingGroup>
    <BindingGroup>
      <BindingGroup.ValidationRules>
        <src:AreasMatch/>
      </BindingGroup.ValidationRules>
    </BindingGroup>
  </ItemsControl.ItemBindingGroup>
  <ItemsControl.ItemContainerStyle>
    <Style TargetType="{x:Type ContentPresenter}">
      <Setter Property="Validation.ValidationAdornerSite"
              Value="{Binding ElementName=validationErrorReport}"/>
    </Style>
  </ItemsControl.ItemContainerStyle>
</ItemsControl>
<Label Name="validationErrorReport" 
       Content="{Binding RelativeSource={RelativeSource Self}, 
       Path=(Validation.ValidationAdornerSiteFor).(Validation.Errors)[0].ErrorContent}"
       Margin="5" Foreground="Red" HorizontalAlignment="Center"/>
	注解
Validation.ValidationAdornerSite和 Validation.ValidationAdornerSiteFor 附加属性相互引用,你可以设置其中一个。 例如,假设 Label 显示对数据绑定 TextBox发生的验证错误。 可以执行以下操作之一来建立该关系:
设置其中一个属性时,另一个属性设置为设置附加属性的元素;无论选择上述哪个选项, Validation.ValidationAdornerSite 的 TextBox 是 Label ,ValidationAdornerSiteFor而 的 Label 是 。TextBox
依赖项属性信息
| 标识符字段 | ValidationAdornerSiteForProperty | 
元数据属性设置为 true | 
无 |