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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show header for Xamarin.Forms TreeView (SfTreeView)

Platform: Xamarin.Forms |
Control: SfTreeView

You can show header for SfTreeView in Xamarin.Forms by customizing the parent grid with label and SfTreeView.


Define Grid with Label as header for TreeView in first row and TreeView in second row.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
        <local:FileManagerViewModel x:Name="viewModel"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="*"/>
            <Label Margin="5" TextColor="Teal" FontAttributes="Bold" FontSize="Medium" HorizontalTextAlignment="Start" 
                        <Span Text="Nodes Count: " TextColor="DarkOrange" />
                        <Span Text="{Binding NodeCount}" TextColor="Green"/>
        <syncfusion:SfTreeView x:Name="treeView" ItemHeight="40" Grid.Row="1" Indentation="15" ExpanderWidth="40"
                              ChildPropertyName="SubFiles" ItemsSource="{Binding ImageNodeInfo}" AutoExpandMode="AllNodesExpanded">


In ViewModel, header label is updated with node count.

namespace TreeViewXamarin
    public class FileManagerViewModel
        public FileManagerViewModel()
        public int NodeCount
            get => ImageNodeInfo.Count();


TreeView Header

View sample in GitHub

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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