Does Binding work ONLY with DependencyProperty?

后端 未结 2 1790
别那么骄傲
别那么骄傲 2021-02-08 06:51

MSDN says,

  • Each binding typically has these four components: a binding target object, a target property, a binding source, and a Path to th

2条回答
  •  一整个雨季
    2021-02-08 07:17

    That's correct. If you look at the source code of WPF toolkit controls you can see how it's done. The DataGrid does it in quite a few places (e.g. specific columns passing the Content binding to the cell). I'll try to remember to add a link to a specific file and line where it's done after work.

    Edit A good example is the Binding property in the DataGridBoundColumn class. You can see it used in

    internal void ApplyBinding(DependencyObject target, DependencyProperty property)
    

    If you're interested in advanced patterns to make WPF and Silverlight controls I highly recommend looking through their respective toolkits. They're well-commented in general and some of the controls are using some cool code.

提交回复
热议问题