connecting to multiple resources

Posted by Dudu on Stack Overflow See other posts from Stack Overflow or by Dudu
Published on 2010-06-08T10:22:15Z Indexed on 2010/06/08 10:32 UTC
Read the original article Hit count: 179

Filed under:
|
|
|

I would like to know if there is a way to connect to multiple resources:

Specifically I have the following problem

abstact class BaseClass
{
  ObservableCollection<BaseClass>;
}

class GrandSonClass:BaseClass{}

class SonClass:BaseClass{}

class FatherClass:BaseClass
{
  CollectionViewSource col = new CollectionViewSource ;
  col.Source = Items.SelectMany(p => p.Items);
}

FatherClass's Items are of ChildrenClass type, and ChildrenClass's Items are of GrandSonClass type;

I want FatherClass to bind to all the GrandSonClass's items it possesses.

The solution of using SelectMany is not good as I need this to be dynamically updated whenever FatherClass adds more Items and whenever its Items(SonClasses) add more Items.

Now I could go on and write notifiaction events but I was wondering if there is a smarter way to do it

-i.e. simply define the sources as the Items of each Item FatherClass posses

© Stack Overflow or respective owner

Related posts about wpf

Related posts about binding