Can I bind a WPF control to a field's property?
binding, c#, wpf, wpf-controls
Solution
No you cant . Because binding system uses Reflection to find the
Property in DataContext(i.e your VM)
It does not look for fields . I hope this will help.
Problem
Because I needed to split some functionality between classes, I've arrived at the following situation xaml code ``` <CheckBox IsChecked="{Binding MyObjectField.MyBoolean}" /> ``` view model ``` ... public MyInternalObject MyObjectField; ... ``` MyObject class ``` public class MyInternalObject { ... public bool MyBoolean { get; set; } ... } ``` It does not work unless I replicate the MyBoolean property in the View Model class. ``` public bool MyBoolean { get { return MyInternalObject.MyBoolean; } set { MyInternalObject.MyBoolean=value; } } ``` Does anyone have an idea?