Binding.Path

获取或设置绑定源属性的路径。

数据绑定概述。

Path 属性可以指定您要绑定到的源值:

  • Path=PropertyName。

  • Order 子属性的绑定。

  • Path=(DockPanel.Dock)。

  • 此外,还支持多个索引器。

  • Path=ShoppingCart.ShippingInfo[MailingAddress,Street].

  • sys 映射到 System 命名空间。

  • 如果源为集合,则此语法指定默认集合视图的当前项。

  • ManagerName 属性的对象。

实例:

How to: Implement Binding Validation。

<
  Style
   x:Key
  ="textBoxInError"
   TargetType
  ="{x:Type TextBox}"
  >
  <Style.Triggers>
    <Trigger Property="Validation.HasError" Value="true">
      <Setter Property="ToolTip"
        Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                        Path=(Validation.Errors)[0].ErrorContent}"/>
    </Trigger>
  </Style.Triggers>
</Style>

 

相关文章:

  • 2021-09-25
  • 2022-02-15
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2021-09-17
  • 2021-07-01
  • 2021-09-03
相关资源
相似解决方案