Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Redirect Childnode Collection
posted

Hey there,

 

Here is the simplified code I use (the board screws code pasting up pretty much - so just c/p it into VS):      

static void Main(string[] args)

{

           

A root = new A { Config = "my root", Filters = new List<B>() };

           

B filter = new B { Filter = "foo", Items = new List<C>() };

           

C soloItem = new C { Name = "solo" };

           

C parent = new C { Name = "parent", Children = new List<C>() };

           

C child1 = new C { Name = "child1", Children = new List<C>() };

           

C child2 = new C { Name = "child2" };

           

C otherSolo = new C { Name = "solo2" };

           

           

filter.Items.Add(parent);

           

filter.Items.Add(child1);

           

filter.Items.Add(child2);

           

filter.Items.Add(soloItem);

           

filter.Items.Add(otherSolo);

           

           

parent.Children.Add(child1);

           

child1.Parent = parent;

           

child1.Children.Add(child2);

           

child2.Parent = child1;

           

/*

             * my root

             * --foo

* ----solo

             * ----child1

             * ------child2

             * ----solo2

             */

        }

    }

   

public class A

    {

       

public String Config { get; set; }

       

public List<B> Filters { get; set; }

    }

   

public class B

    {

       

public String Filter { get; set; }

       

public List<C> Items { get; set; }

       

public List<C> DisplayItems

        {

           

get

            {

               

return Items.Where(x => x.Parent == null).ToList();

            }

        }

    }

   

public class C

    {

       

public String Name { get; set; }

       

public C Parent { get; set; }

       

public List<C> Children { get; set; }

    }

 

A is the root and has a collection of B.
B has a collection of ALL C.
C can have a Parent C and a collection of Child C.

When displaying B, I want only Cs to appear which do not have a Parent. But those shall appear as Children of Cs.
To do so, B provides a wrapped property (DisplayItems) returing the filtered collection.

What i have so far is:

                <ig:XamDataTree.GlobalNodeLayouts>                     <ig:NodeLayout TargetTypeName="A" Key="a"/>                     <ig:NodeLayout TargetTypeName="B" Key="b"/>                     <ig:NodeLayout TargetTypeName="C" Key="c"/>                 </ig:XamDataTree.GlobalNodeLayouts>

 

I tried with nested NodeLayouts and Assigning keys... but the Result was pretty useless...

 

Can u help?

 

Parents Reply Children
No Data