C # binding list made from required lists

Is there an easy way to have a list of bindings made up of several required lists? those. this is the "view" of lists.

That is: I have 3 lists (list1, list2, list3). I want a list, which is always a union of 3 listx (we can assume that no object is contained in two different lists).

Of course, I can succeed in using the ListChange property, but maybe there is a smarter way to do this?

+3
source share
2 answers

To do this, you need to create your own type, implement IList, IBindingList(and ideally IBindingListView) and optionally ICancelAddNewand IRaiseItemChangedEvents. You will also need a public index object ( public T this[int index] {get;}) or ITypedList.

Due to the fact that I did something similar, I strongly advise you; do not do this if it is really important. It would be more pragmatic to copy links to a new one BindingList<>.

Also; with new goods; what list will he enter?

+1
source

Have you looked at the CompositeCollection class?

, , : ( , /). , CompositeCollection BindingList. CompositeCollection , "" .

+1

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


All Articles