首页 > Windows开发 > 详细

WPF data binding

时间:2016-11-16 19:34:03      阅读:235      评论:0      收藏:0      [点我收藏+]

Binding这个类包含以下几个常用的属性:

ElementName: Gets or sets the name of the elements to use as the binding source object. [Default is null]

Source: Gets or sets the object to use as the binding source. 

RelativeSource: Gets or sets the binding source by specifying its location relative to the position of the binding target.

Converter: Gets or sets the converter to use.

Mode: Gets or sets a value that indicates the direction of the data flow in the binding.

Path: Gets or sets the path to the binding source property.

StringFormat: Gets or sets a string that specifies how to format the binding if it displays the bound value as a string.(Inherited from BindingBase.)

  • Only one of the three properties, ElementName, Source, and RelativeSource, should be set for each binding, or a conflict might occur. 
  • By default, bindings inherit the data context specified by the DataContext property
  • Path is the default property of a binding. {Binding PropertyName} 等价于 {Binding Path=PropertyName}
  • {Binding} is equivalent to {Binding Path=.}, which binds to the current source

 

参考链接:

https://msdn.microsoft.com/en-us/library/system.windows.data.binding(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/ms750413.aspx

http://stackoverflow.com/questions/1906587/wpf-bind-to-itself

https://msdn.microsoft.com/en-us/library/ms746695(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/ms752347(v=vs.110).aspx

WPF data binding

原文:http://www.cnblogs.com/liangzi4000/p/6070656.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!