I'm having trouble getting checkboxes to bind correctly with a database (using VS 2010; WPF 4.5). If I use XAML to bind, no problems. But, if I try to bind to a Boolean entity property using code such as...
Binding bind =newBinding(path);
bind.Mode =BindingMode.TwoWay;
((CheckBox)uiElement).SetBinding(CheckBox.IsCheckedProperty, bind));
the checkbox will fail to display the database value on rendering, and won't persist back any change when clicked. Oddly, I have other controls (e.g., textboxes) that use analagous binding code - these work fine! I checked that the entity being bound contains the correct value.
In searching for solutions on the internet, I notice that there have been issues with checkboxes (and other ToggleButton controls) in the past, but I've seen nothing about wpf 4.5 having such issues.
Where am I going wrong here? Suggestions?
Thanks
Eric