C# / WPF - BindingList<T> containing and maintaining the contents of a HashSet<BindingList<T>>
I want a master BindingList<T>
which contains a reference to all the items in child lists and开发者_Python百科
Does this already exist or should I create one? I guess it would be an AggregatedBindingList<T>
which would have a constructor;
public AggregatedBindingList<T>(IEnumerable<BindingList<T> items)
And methods;
public bool AddBindingList(BindingList<T> list);
public bool RemoveBindingList(BindingList<T> list);
Where I'd hook into the Add/Remove/Clear change events and update the master accordingly.
My data structure is not too dissimilar to the below if we imagine each as a BindingList (the count is displayed) and Inhabitants are only added to the leaf lists but I want to maintain the root correctly.
GB - 1050
|- England - 230
|- Wales - 200
|- Scotland - 620
I'm sure I can write something but this must have been done before, no?
精彩评论