3

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 binding work with properties), but is it even technically possible?

Community
  • 1
  • 1
Greg Sansom
  • 20,442
  • 6
  • 58
  • 76

1 Answers1

2

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.)

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373