Adding Lists of lists of lists, etc. as itemsource on radtreeView

2 posts, 0 answers
  1. Mahlatse
    Mahlatse avatar
    6 posts
    Member since:
    Sep 2016

    Posted 06 Mar Link to this post

    I am trying to add a list of lists of lists to a radtreeView but the child elements never appear, I have used a HeirichalDataTemplate as a test for the first 2 elements, is there something I am missing , given the following xalm 

    <pre>

    <telerik:RadTabItem Header="Lookup Sets">
                                <telerik:RadTreeView IsLoadOnDemandEnabled="True" ItemsSource="{Binding AttributeLookupSetConversions}">
                                    <telerik:RadTreeView.Resources>
                                        <HierarchicalDataTemplate DataType="{x:Type cm:AttributeLookupSetConversion}">
                                            <CheckBox Content="{Binding Path=Name}"  IsChecked="{Binding Path=IsSelected, Mode=TwoWay}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerikDocking:RadSplitContainer}}, Path=DataContext.UpdateSelectionCommand}"/>
                                        </HierarchicalDataTemplate>
                                        <HierarchicalDataTemplate DataType="{x:Type cm:AttributeConversion}">
                                            <CheckBox Content="{Binding Path=Name}"  IsChecked="{Binding Path=IsSelected, Mode=TwoWay}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type telerikDocking:RadSplitContainer}}, Path=DataContext.UpdateSelectionCommand}"/>
                                        </HierarchicalDataTemplate>
                                    </telerik:RadTreeView.Resources>
                                </telerik:RadTreeView>
                            </telerik:RadTabItem>

    </pre>

     

    I cant seem to get the UI to show its child elements

  2. Dinko
    Admin
    Dinko avatar
    395 posts

    Posted 08 Mar Link to this post

    Hello Mahlatse,

    Thank you for your interest in RadTreeView control.

    Looking at the provided code snippet we can see that you haven't set the ItemsSource property of a HierarchicalDataTemplate which will represent the parent collection. You can take a look at the Hierarchical Data Templates help article in our documentation which described how you can bind the tree view to show collections that contain other collections.

    Give it a try and let us know if it works for you.

    Regards,
    Dinko
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top