observable - Merge ObservableCollections and being notified of changes? -
i want merge x collections , being notified if 1 of changed (add/remove).
i have following code using compositecollection i'm not notified when changes in sub-collections.
void main() { var col1 = new observablecollection<string>(); var col2 = new observablecollection<string>(); var col3 = new observablecollection<string>(); col1.add("item 1-1"); col1.add("item 1-2"); col2.add("item 2-1"); var cc = new compositecollection(); cc.add(col1); cc.add(col2); var ncc = (inotifycollectionchanged)cc; ncc.collectionchanged += collectionchanged; //col3.add("item 3-1"); //cc.add(new collectioncontainer() { collection = col3 }); col1.add("item 1-3"); col2.add("item 2-2"); } public void collectionchanged(object sender, notifycollectionchangedeventargs e) { "collection changed!".dump(); }
i'm notified if collection added compositecollection (the 2 commented lines) not if add col1 or col2...
is there way achieve easily? (i have solution using observables seems using cannon kill fly...)
thanks help!
Comments
Post a Comment