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
90
GenericList as an ItemsSource
posted

I have a List<T> object. It has a children from the same type (Tree[].Tree[].Tree[]...). How can i use this structure, to show as a tree?

This is my class and list from it:

 

class Tree
{

public string Name { get; set; }
List<Tree> children;

}

xamDataTree.ItemsSource = List<Tree> object

Where is my error? I can see only the root level of the tree.

Parents
  • 495
    posted

    Hi Synthy,

    I suppose that in your XAML you missed definition of 'NodeLayout'.
    In XAML your tree shoud be:

    <ig:XamDataTree x:Name="dataGlobalTree"
                            ItemsSource="{Binding Object}" >
                <ig:XamDataTree.GlobalNodeLayouts>
                    <ig:NodeLayout Key="Data"
                                   DisplayMemberPath="Name"
                                   TargetTypeName="Tree"></ig:NodeLayout>
                </ig:XamDataTree.GlobalNodeLayouts>
    </ig:XamDataTree>

Reply Children