When binding to a combobox SelectedItem, the change is only notified of the lost focus. How to notify when a selection is changed?

I knitted it using

cmbPeriod.DataBindings.Add("SelectedItem", Presenter, "SelectedDate", true, DataSourceUpdateMode.OnPropertyChanged); 

But it only launches into a related model when I exit the control, I would like it to work when users make a new choice.

EDIT: Okay, so I tried binding with SelectedValue and left ValueMember as null . This led to updating the source as soon as the combo box changes with the correct object, however now combobox ignores updates from the source!

I see that it requests binding at runtime, and the source property returns the correct object, which is the same type that will update the source code when it changes. Ugh! So close:(

+6
source share
1 answer
 cmbPeriod.DataBindings.Add("SelectedValue", Presenter, "SelectedDate", true, DataSourceUpdateMode.OnPropertyChanged); 

binding to SelectedValue working on change

+3
source

Source: https://habr.com/ru/post/915998/


All Articles