Is there a way to follow a binding in code?

前端 未结 1 1007
太阳男子
太阳男子 2021-01-22 10:18

If i have a Binding which has a property path and the data source can i execute it in code, to find the value?

The path that i am trying to follow can be quite complicat

1条回答
  •  深忆病人
    2021-01-22 10:39

    You can avoid using a ContentControl, and write your own very simple class that derives directly from DependencyObject, and provides a single DependencyProperty, which you can then target with the binding. Aside from that, no, there isn't any better way - binding machinery in WPF is very much tied into the concept of dependency properties, and a binding cannot really be a "free-standing expression" that is just evaluated.

    0 讨论(0)
提交回复
热议问题