We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

TreeView does not show child node

I use listview store parent and child description but there doesn't show in treeView.
Can use list to store treeview data instead of use class inherited?


  <syncfusion:SfTreeView x:Name="treeView" ItemsSource="{Binding treeView}" ItemHeight="40" ExpanderWidth="40" Indentation="20" 
                                               IsAnimationEnabled="true" FullRowSelect="True" >
                                <treeviewengine:HierarchyPropertyDescriptor TargetType="{x:Type local:TreeView}" ChildPropertyName= "childDesc"/>
                                    <Grid Padding="5,0,0,0" BackgroundColor="Transparent">
                                        <Label Text="{Binding parentDesc}" TextColor="Black" FontSize="Medium" VerticalTextAlignment="Center"/>

     public List<TreeView> GetTreeView()
            var TreeView = new List<TreeView>()
                new TreeView(){parentDesc = "1Bedside"},
                new TreeView(){parentDesc = "2", childDesc = "C2"},
                new TreeView(){parentDesc = "3", childDesc = "C3"},
                new TreeView(){parentDesc = "4", childDesc = "C4"},
                new TreeView(){parentDesc = "5", childDesc = "C5"},

            return TreeView;


1 Reply

SR Sangeetha Raju Syncfusion Team August 23, 2019 11:40 AM UTC

Hi Chua, 
We suspect that you are trying to  provide a collection to the ChildPropertyName. You can’t achieve it by providing a collection.  We would like to inform you that you can achieve your requirement by providing the ChildPropertyName as the class name for which the collection should be maintained in the Model class. We have prepared sample based on your query. Please find the sample from the below link. 
We have already mentioned in our documentation. Please refer the below link for further information. 
Please let us know if you have any concern. 
Sangeetha Raju. 

Live Chat Icon For mobile
Up arrow icon