ToolStripComboBox.SelectedItem change does not propagate to binding source
- by Marius
My binding is set up as this:
        _selectXAxisUnitViewModelBindingSource = new BindingSource();
        _selectXAxisUnitViewModelBindingSource.DataSource = typeof(SelectXAxisUnitViewModel);
        _selectedUnitComboBoxBindingSource = new BindingSource();
        _selectedUnitComboBoxBindingSource.DataSource = _selectXAxisUnitViewModelBindingSource;
        _selectedUnitComboBoxBindingSource.DataMember = "AvailableUnits";
        _selectedUnitComboBox.ComboBox.DataSource = _selectedUnitComboBoxBindingSource;
        _selectedUnitComboBox.ComboBox.DisplayMember = String.Empty;
        _selectedUnitComboBox.ComboBox.ValueMember = String.Empty;
        _selectedUnitComboBox.ComboBox.DataBindings.Add("SelectedItem",
                                                        _selectXAxisUnitViewModelBindingSource, 
                                                        "SelectedUnit", true, DataSourceUpdateMode.OnPropertyChanged);
        // this is a bug in the .Net framework: http://connect.microsoft.com/VisualStudio/feedback/details/473777/toolstripcombobox-nested-on-toolstripdropdownbutton-not-getting-bindingcontext
        _selectedUnitComboBox.ComboBox.BindingContext = this.BindingContext;
The property "AvailableUnits" is a collection of strings and the "SelectedUnit" is a string-property. Now the dropdown list is populated as expected, but when I select and item in the list, the change is not propagated to the binding source. Any idea what I am doing wrong?