Anyone knows how to do this?
I tried this, but it just populates this ComboBox which I already do.
What I need is a way to get the combobox updated whenever the enum property on my object changes:
DataObject.DataEnum
but also get the above Enum updated whenever I change the selected item in the combobox.
Is it possible to do this?
Normally I am used to do the binding this way:
this.TextBox.DataBindings.Add ( "Text", this.DataObject, "Name", false, DataSourceUpdateMode.OnPropertyChanged );
which works great.
You can use a two-way binding on the SelectedItem property of the ComboBox. When adding values to the combo box, be sure to add the enum values and not just strings that match their display name.
Now SelectedItem can be set or get as the enum instead of as a string.
EDIT
It sounds like maybe your object doesn’t raise property change notifications which Windows Forms requires to detect that changes to the underlying object need to be refreshed in the UI. Here is an article about how to do that.
EDIT 2
Here’s a code sample. I verified this works correctly.