I have a boolean setting in my Properties/Settings.settings file, which basically stores per user “Right to Left” or “Left to Right” display mode.
I have a checkbox in my Ribbon which I have bound to the value. It appears however that the binding is only 1 way. Is there any way I can make this two way without having to write code to persist the setting?
Clarification
I have successfully configured the application to bind to the settings when it is first loaded. The problem is that this is a one-direction bind, i.e. the UI updates when settings are changed, but settings don’t change when the UI is changed.
Hence my question…how can I configure two-way binding against user settings?
I can write event handlers to do all of this manually, but I figured that defies the point of using binding.
This works on my machine solely by using visual studio designer, so I would try ruling things out.
First, I would set the checkbox on a regular form and see if that helps. What component/library are you using for the ribbon? Are you using DevExpress? I know DevExpress has no databinding support for Ribbon-controls. Are you using other components or your own code for that?
Second, note that the order of events is not as you might expect. It can very well be that first the CheckedChanged-event is fired and after that the value is synchronized with the Settings. So instead of using the CheckedChanged event I would use a separate button that gets the focus and check within that handler if the value is synchronized.
Third, you could also override the CheckedChanged event and push the new databinding value to the underlying datasource. I’ve done that for many controls and works like a charm.