开发者

Has it ever been possible to bind to a field in WPF?

开发者 https://www.devze.com 2023-02-18 02:47 出处:网络
Someone suggested in another question that they, at some point, were able to bind a value to a field in WPF.

Someone suggested in another question that they, at some point, were able to bind a value to a field in WPF.

I know that this is not a supported scenario (and personally I have only seen bi开发者_运维问答nding work with properties), but is it even technically possible?


No. Binding in WPF uses either a PropertyDescriptor or the Dependency Property mechanism, which only works on Properties.

(Technical note here: A Dependency Property is technically sort of a field - it's defined as a field, then registered with the DP system, though, and treated more like a property, so I would still call it a property... The field itself doesn't actually store the data in the case of a DP.)

0

精彩评论

暂无评论...
验证码 换一张
取 消