I have two columns in my data source that is editable and is a boolean value. My data object implement INotifyPropertyChanged. Two questions:
1. When I initially run the app, all checkboxes are kinda grayed out, in some intermediate state, even though my data objects certain have values fro those boolean properties. How can I make sure they properly load?
2. The value of one bool depends on the other. The two properties cannot be true, but any other combination is possible. To this end, my data object has logic so if: valA is set to true, if valB is true, property valB is set to false and vice-versa. The issue is that the actual setter is not called by the Check Editor until the checkbox is unfocused. What's my best way to go around this? Should I attach custom event handlers to valuechanged? Should I create an unbound column and create a control template that displays my own custom checkbox with custom handlers?
Thanks,
-Szymon
Hello Szymon,
Are you binding the check editor directly to your CLR object (which has INotifyPropertyChanged) or to a DependencyProperty? When the data changes, the INotifyPropertyChanged event should trigger the data to update in the UI and if using a DependencyProperty you get the same behavior. If you could post or attach some code or a sample project which demonstrates the problem, I might see what is going on and offer a solution.
Ok. I have attached a project that replicates both issues I am seeing. So basically I'm not doing any of the binding myself; I let the grid do it for me. In my actual xaml, I define my own field, editor types and edit as, but the behavior is exactly the same as allowing the grid to create the fields on its own.