Posted 11 May 2023, 9:38 pm EST
I’m trying figure out how I can make the C1ComboBox behave similar to the standard Winforms ComboBox when it comes to data binding, but so far no luck, maybe someone can provide me some clues? The only reason I prefer to use C1ComboBox is because of its text aligning features.
My scenario:
- combobox simply lists the ‘name’ (string) property of the connected data source for all items visible in dropdown mode or when selected
- the ‘id’ (int) property of the selected item for the connected data source should determine the value of a property of a (bound) BindingSource object
E.g. the combobox allows the user to select a country (and displays the country names in the dropdown) for a customer, but the corresponding country ‘id’ (int) value in the connected data source then should be bound to the ‘country’ property (int) of a customer BindingSource.
With a standard Winforms Combobox this is easily done like this:
this.winCombobox.DataSource = this.CountryBindingSource;
this.winCombobox.DisplayMember = "name";
this.winCombobox.ValueMember = "id";
this.winCombobox.DataBindings.Add("SelectedValue", this.CustomerBindingSource, "country");
But how to do the same with the C1ComboBox? I cannot find a sample online that guides me in this.