I have a checkbox, that when you check it, it brings up a messagebox trying to verify that you are sure you want to check the box. The problem is, if you set the value back to false, using INotifyChanged, it still makes the checkbox checked. Is there any other way to do this, or am I missing something?
I attached a sample project showing exactly what is going on.
Thanks
You would call BeginInvoke and set the value back in the callback.
Andrew,
Can you explain how you would implement the BeginInvoke a little bit? Not too sure on how to implement what you are suggesting...
This is actually a bug/behavior in WPF. It looks like while WPF is updating the source binding it doesn't take the value from the source after it sets it and instead continues to use the value it was being changed to. So in this case the CheckBox is updating its IsChecked to true. That pushes true into the XamCheckEditor's IsChecked which results in the ValueChanged being invoked. You are changing the value of the source (but it happens even if you set the XCE's IsChecked), and that pushes into the XamCheckEditor's IsChecked but the CheckBox which was in the process of pushing the property change to true into the source continues on to change its IsChecked property to true. I would recommend not changing it directly in this event but instead doing a BeginInvoke on the Dispatcher and set it back there. Note, I tested this out with WPF 4 and it works properly so it seems like MS addressed this in that version.