代码之家  ›  专栏  ›  技术社区  ›  Sergey Aldoukhov

在WPF绑定中“绑定路径=”是什么意思?

  •  69
  • Sergey Aldoukhov  · 技术社区  · 15 年前

    什么? {Binding Path=.} 在wpf绑定中是什么意思?

    我看到有人用它,但找不到任何解释。

    绑定语法中是否有其他特殊符号(除了 {Binding /} )?

    2 回复  |  直到 15 年前
        1
  •  48
  •   micahtan    15 年前

    这是绑定到当前源的简写。有关详细信息,请参阅 here .

        2
  •  56
  •   Ryan Versaw    15 年前

    我发现了这个 WPF Binding CheatSheet 几个月前,发现它非常有用,特别是对于任何学习WPF的人。里面有一些拼写错误,但仍然很好。

    下面是一个小摘录(应该是表格格式):

    Basic Binding   
    {Binding}  Bind to current DataContext. 
    {Binding Name}  Bind to the “Name” proeprty of the current DataContext. 
    {Bindind Name.Length}  Bind to the Length property of the object in the Name property of the current DataContext. 
    {Binding ElementName=SomeTextBox, Path=Text}  Bind to the “Text” property of the element XAML element with name=”SomeTextBox” or x:Name=”SomeTextBox”. 
    

    Direct link to CheatSheet