This is a migrated thread and some comments may be shown as answers.

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

1 Answer 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mahlatse
Top achievements
Rank 1
Mahlatse asked on 06 Mar 2017, 08:15 AM

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

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 08 Mar 2017, 02:28 PM
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 you to write beautiful native mobile apps using a single shared C# codebase.
Tags
General Discussions
Asked by
Mahlatse
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or