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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TreeView does not show child node

Thread ID:

Created:

Updated:

Platform:

Replies:

146862 Aug 23,2019 04:07 AM UTC Aug 23,2019 11:40 AM UTC Xamarin.Forms 1
loading
Tags: SfTreeView
Chua Shin Jiuan
Asked On August 23, 2019 04:07 AM UTC

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?


XAML

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

.CS
     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;

        }



Sangeetha Raju [Syncfusion]
Replied On 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. 
 
Regards, 
Sangeetha Raju. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon