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
2165
XamDataTree Multiple Node Types
posted

Hi,

I have the following structure:

Folder

{

    string Name;

    List<Node> childFolders;

    List<Element> childFiles;

};

File

{

    string Name;

    int size;

   etc...

};

A tree node can be either a Folder element or a File element. When displaying a folder, I only need to display the name, but when displaying a file, I need to display all data in the File structure in a datagrid.

I have tried setting the following GlobalNodeLayouts:

<ig:XamDataTree x:Name="MyTree" ItemsSource="{Binding MyData}">
    <ig:XamDataTree.GlobalNodeLayouts>
        <ig:NodeLayout Key="Folders"
                                TargetTypeName="Folder"
                                DisplayMemberPath="Name">
        </ig:NodeLayout>

        <ig:NodeLayout Key="Files"
                                TargetTypeName="File"
                                DisplayMemberPath="Name">
            <ig:NodeLayout.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <igDP:XamDataGrid>
                                        </igDP:XamDataGrid>
                                    </Grid>
                                </DataTemplate>
            </ig:NodeLayout.ItemTemplate>
        </ig:NodeLayout>
    </ig:XamDataTree.NodeLayouts>
</ig:XamDataTree>

but with this structure I get the File layouts even when I have no Files in the folder. Also, I am having trouble binding to the datagrid. Can you let me know the correct syntax for binding to the datagrid?

I would like to display files when they are present and folders when folders are present.

Thanks