How does the BindingList <T> know the selected item?

When you use a BindingList as a Binding, you can say that a ListBox

listBox.DataSource = myBindingList;

and bind some labels to the same source:

labelName.DataBindings.Add("Text",
                           myBindingList,
                           "Name",
                           false,
                           DataSourceUpdateMode.OnPropertyChanged);

The meaning of the labels changes when SelectedItemmy list changes .

Why do the values ​​of my labels always refer to the currently selected item?

How do they know, simply by providing them BindingListas a source, which element in the list is selected?

+4
source share
1 answer

BindingContext CurrencyManager. BindingContext ( ) , CurrencyManager BindingContext . : , , , , CurrencyManager. CurrencyManager .

: BindingContext ; - , BindingContext.

+1

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


All Articles