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

Ser*_*hov 81 data-binding wpf xaml

{Binding Path=.}WPF绑定意味着什么?

我看到有些人使用它,但找不到任何解释.

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

Rya*_*saw 60

几个月前我发现了这个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”. 
Run Code Online (Sandbox Code Playgroud)

直接链接到CheatSheet

  • 不错,但是{Binding。}是什么。我正在寻找关于此的解释,但是找不到? (2认同)

mic*_*tan 53

这是绑定到当前源的简写.有关详情,请参阅此处.

  • 所以这是{Binding}的缩写.好的,很高兴知道. (34认同)
  • 另一个例子:<TextBlock Text ="{Binding Converter = ...}"/>不起作用,因为你必须设置Path.在那种情况下Path =.很有用. (8认同)
  • 我无法与MSDN争论,但仍然存在差异.{Binding}不能在对象本身上使用(它需要属性的两种方式),而{Binding Path =.}有效. (5认同)