menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TreeMapLevel - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class TreeMapLevel

    Represents a level in the hierarchical structure of the SfTreeMap.

    Inheritance
    System.Object
    TreeMapLevel
    Namespace: Syncfusion.Maui.TreeMap
    Assembly: Syncfusion.Maui.TreeMap.dll
    Syntax
    public class TreeMapLevel : Element, IThemeElement

    Constructors

    TreeMapLevel()

    Initializes a new instance of the TreeMapLevel class.

    Declaration
    public TreeMapLevel()

    Fields

    BackgroundProperty

    Identifies the Background dependency property.

    Declaration
    public static readonly BindableProperty BackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Background dependency property.

    GroupPathProperty

    Identifies the GroupPath dependency property.

    Declaration
    public static readonly BindableProperty GroupPathProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for GroupPath dependency property.

    HeaderHeightProperty

    Identifies the HeaderHeight dependency property.

    Declaration
    public static readonly BindableProperty HeaderHeightProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for HeaderHeight dependency property.

    SpacingProperty

    Identifies the Spacing dependency property.

    Declaration
    public static readonly BindableProperty SpacingProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Spacing dependency property.

    StrokeProperty

    Identifies the Stroke dependency property.

    Declaration
    public static readonly BindableProperty StrokeProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Stroke dependency property.

    StrokeWidthProperty

    Identifies the StrokeWidth dependency property.

    Declaration
    public static readonly BindableProperty StrokeWidthProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for StrokeWidth dependency property.

    TextStyleProperty

    Identifies the TextStyle dependency property.

    Declaration
    public static readonly BindableProperty TextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TextStyle dependency property.

    Properties

    Background

    Gets or sets the background brush for the tree map header items in the SfTreeMap.

    Declaration
    public Brush Background { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value of Background is null.

    Examples

    The below examples shows, how to set Background property of TreeMapLevel in the SfTreeMap.

    • XAML
    • C#
    • C#
    • C#
     <treemap:SfTreeMap x:Name="treeMap"
                        PrimaryValuePath="EmployeesCount"
                        DataSource="{Binding EmployeeDetails}">
       <treemap:SfTreeMap.BindingContext>
           <local:EmployeeViewModel />
       </treemap:SfTreeMap.BindingContext>
        <treemap:SfTreeMap.Levels>
       <treemap:TreeMapLevel GroupPath="Country"
                             Background="Green"/>
        </treemap:SfTreeMap.Levels>
      <treemap:SfTreeMap.LeafItemBrushSettings>
           <treemap:TreeMapUniformBrushSettings Brush="Orange">
           </treemap:TreeMapUniformBrushSettings>
       </treemap:SfTreeMap.LeafItemBrushSettings>
       <treemap:SfTreeMap.LeafItemSettings>
           <treemap:TreeMapLeafItemSettings LabelPath="JobDescription">
           </treemap:TreeMapLeafItemSettings>
       </treemap:SfTreeMap.LeafItemSettings>
    </treemap:SfTreeMap>
    public class EmployeeDetails
    {
       public string Category { get; set; }
       public string Country { get; set; }
       public string JobDescription { get; set; }
       public string JobGroup { get; set; }
       public int EmployeesCount { get; set; }
    }
    public class EmployeeViewModel
    {
        public EmployeeViewModel()
        {
           this.EmployeeDetails = new ObservableCollection<EmployeeDetails>()
           {
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 100 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 30 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 40 },
           };
        }
       public ObservableCollection<EmployeeDetails> EmployeeDetails
       {
           get;
           set;
        }
    }
    this.treeMap.Levels.Add(new TreeMapLevel() { GroupPath = "Country", Background = Brush.Green });
    See Also
    Stroke
    StrokeWidth
    Spacing
    TextStyle
    HeaderHeight

    GroupPath

    Gets or sets the property path used for grouping tree map items in the SfTreeMap.

    Declaration
    public string GroupPath { get; set; }
    Property Value
    Type Description
    System.String

    The default value of GroupPath is System.String.Empty.

    Remarks

    This property specifies the name of the property in the data object that determines how items in the tree map are grouped. The grouping is based on the values of this property in the data source, which splits the level into distinct groups.

    Examples

    The below examples shows, how to set GroupPath property of TreeMapLevel in the SfTreeMap.

    • XAML
    • C#
    • C#
    • C#
     <treemap:SfTreeMap x:Name="treeMap"
                        PrimaryValuePath="EmployeesCount"
                        DataSource="{Binding EmployeeDetails}">
       <treemap:SfTreeMap.BindingContext>
           <local:EmployeeViewModel />
       </treemap:SfTreeMap.BindingContext>
        <treemap:SfTreeMap.Levels>
       <treemap:TreeMapLevel GroupPath="Country"
                             Stroke="Gray"/>
        </treemap:SfTreeMap.Levels>
      <treemap:SfTreeMap.LeafItemBrushSettings>
           <treemap:TreeMapUniformBrushSettings Brush="Orange">
           </treemap:TreeMapUniformBrushSettings>
       </treemap:SfTreeMap.LeafItemBrushSettings>
       <treemap:SfTreeMap.LeafItemSettings>
           <treemap:TreeMapLeafItemSettings LabelPath="JobDescription">
           </treemap:TreeMapLeafItemSettings>
       </treemap:SfTreeMap.LeafItemSettings>
    </treemap:SfTreeMap>
    public class EmployeeDetails
    {
       public string Category { get; set; }
       public string Country { get; set; }
       public string JobDescription { get; set; }
       public string JobGroup { get; set; }
       public int EmployeesCount { get; set; }
    }
    public class EmployeeViewModel
    {
        public EmployeeViewModel()
        {
           this.EmployeeDetails = new ObservableCollection<EmployeeDetails>()
           {
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 100 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 30 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 40 },
           };
        }
       public ObservableCollection<EmployeeDetails> EmployeeDetails
       {
           get;
           set;
        }
    }
    this.treeMap.Levels.Add(new TreeMapLevel() { GroupPath = "Country", Stroke = Brush.Gray });
    See Also
    Stroke
    Background
    StrokeWidth
    Spacing
    TextStyle
    HeaderHeight

    HeaderHeight

    Gets or sets the height of the header for each level in the SfTreeMap.

    Declaration
    public double HeaderHeight { get; set; }
    Property Value
    Type Description
    System.Double

    The default value of HeaderHeight is 24.

    Examples

    The below examples shows, how to set HeaderHeight property of TreeMapLevel in the SfTreeMap.

    • XAML
    • C#
    • C#
    • C#
     <treemap:SfTreeMap x:Name="treeMap"
                        PrimaryValuePath="EmployeesCount"
                        DataSource="{Binding EmployeeDetails}">
       <treemap:SfTreeMap.BindingContext>
           <local:EmployeeViewModel />
       </treemap:SfTreeMap.BindingContext>
       <treemap:SfTreeMap.Levels>
       <treemap:TreeMapLevel GroupPath="Country"
                             Stroke="Gray"
                             HeaderHeight="20">
         </treemap:TreeMapLevel>
       </treemap:SfTreeMap.Levels>
      <treemap:SfTreeMap.LeafItemBrushSettings>
           <treemap:TreeMapUniformBrushSettings Brush="Orange">
           </treemap:TreeMapUniformBrushSettings>
       </treemap:SfTreeMap.LeafItemBrushSettings>
       <treemap:SfTreeMap.LeafItemSettings>
           <treemap:TreeMapLeafItemSettings LabelPath="JobDescription">
           </treemap:TreeMapLeafItemSettings>
       </treemap:SfTreeMap.LeafItemSettings>
    </treemap:SfTreeMap>
    public class EmployeeDetails
    {
       public string Category { get; set; }
       public string Country { get; set; }
       public string JobDescription { get; set; }
       public string JobGroup { get; set; }
       public int EmployeesCount { get; set; }
    }
    public class EmployeeViewModel
    {
        public EmployeeViewModel()
        {
           this.EmployeeDetails = new ObservableCollection<EmployeeDetails>()
           {
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 100 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 30 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 40 },
           };
        }
       public ObservableCollection<EmployeeDetails> EmployeeDetails
       {
           get;
           set;
        }
    }
    this.treeMap.Levels.Add(new TreeMapLevel() { GroupPath = "Country", Stroke = Brush.Gray, HeaderHeight = 20 });
    See Also
    Background
    Stroke
    StrokeWidth
    Spacing
    TextStyle

    Spacing

    Gets or sets the spacing between the tree map header items in the SfTreeMap.

    Declaration
    public double Spacing { get; set; }
    Property Value
    Type Description
    System.Double

    The default value of Spacing is 4.

    Examples

    The below examples shows, how to set Spacing property of TreeMapLevel in the SfTreeMap.

    • XAML
    • C#
    • C#
    • C#
     <treemap:SfTreeMap x:Name="treeMap"
                        PrimaryValuePath="EmployeesCount"
                        DataSource="{Binding EmployeeDetails}">
       <treemap:SfTreeMap.BindingContext>
           <local:EmployeeViewModel />
       </treemap:SfTreeMap.BindingContext>
        <treemap:SfTreeMap.Levels>
       <treemap:TreeMapLevel GroupPath="Country"
                             Stroke="Gray"
                             Spacing="1"/>
        </treemap:SfTreeMap.Levels>
      <treemap:SfTreeMap.LeafItemBrushSettings>
           <treemap:TreeMapUniformBrushSettings Brush="Orange">
           </treemap:TreeMapUniformBrushSettings>
       </treemap:SfTreeMap.LeafItemBrushSettings>
       <treemap:SfTreeMap.LeafItemSettings>
           <treemap:TreeMapLeafItemSettings LabelPath="JobDescription">
           </treemap:TreeMapLeafItemSettings>
       </treemap:SfTreeMap.LeafItemSettings>
    </treemap:SfTreeMap>
    public class EmployeeDetails
    {
       public string Category { get; set; }
       public string Country { get; set; }
       public string JobDescription { get; set; }
       public string JobGroup { get; set; }
       public int EmployeesCount { get; set; }
    }
    public class EmployeeViewModel
    {
        public EmployeeViewModel()
        {
           this.EmployeeDetails = new ObservableCollection<EmployeeDetails>()
           {
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 100 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 30 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 40 },
           };
        }
       public ObservableCollection<EmployeeDetails> EmployeeDetails
       {
           get;
           set;
        }
    }
    this.treeMap.Levels.Add(new TreeMapLevel() { GroupPath = "Country", Background = Brush.Green, Spacing = 1 });
    See Also
    Background
    Stroke
    StrokeWidth
    TextStyle
    HeaderHeight

    Stroke

    Gets or sets the stroke color for the tree map header items in the SfTreeMap.

    Declaration
    public Brush Stroke { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value of Stroke is new SolidColorBrush(Color.FromArgb("#CAC4D0")).

    Examples

    The below examples shows, how to set Stroke property of TreeMapLevel in the SfTreeMap.

    • XAML
    • C#
    • C#
    • C#
     <treemap:SfTreeMap x:Name="treeMap"
                        PrimaryValuePath="EmployeesCount"
                        DataSource="{Binding EmployeeDetails}">
       <treemap:SfTreeMap.BindingContext>
           <local:EmployeeViewModel />
       </treemap:SfTreeMap.BindingContext>
        <treemap:SfTreeMap.Levels>
       <treemap:TreeMapLevel GroupPath="Country"
                             Stroke="Gray"/>
        </treemap:SfTreeMap.Levels>
      <treemap:SfTreeMap.LeafItemBrushSettings>
           <treemap:TreeMapUniformBrushSettings Brush="Orange">
           </treemap:TreeMapUniformBrushSettings>
       </treemap:SfTreeMap.LeafItemBrushSettings>
       <treemap:SfTreeMap.LeafItemSettings>
           <treemap:TreeMapLeafItemSettings LabelPath="JobDescription">
           </treemap:TreeMapLeafItemSettings>
       </treemap:SfTreeMap.LeafItemSettings>
    </treemap:SfTreeMap>
    public class EmployeeDetails
    {
       public string Category { get; set; }
       public string Country { get; set; }
       public string JobDescription { get; set; }
       public string JobGroup { get; set; }
       public int EmployeesCount { get; set; }
    }
    public class EmployeeViewModel
    {
        public EmployeeViewModel()
        {
           this.EmployeeDetails = new ObservableCollection<EmployeeDetails>()
           {
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 100 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 30 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 40 },
           };
        }
       public ObservableCollection<EmployeeDetails> EmployeeDetails
       {
           get;
           set;
        }
    }
    this.treeMap.Levels.Add(new TreeMapLevel() { GroupPath = "Country", Stroke = Brush.Gray });
    See Also
    Background
    StrokeWidth
    Spacing
    TextStyle
    HeaderHeight

    StrokeWidth

    Gets or sets the width of the stroke for the tree map header items in the SfTreeMap.

    Declaration
    public double StrokeWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The default value of StrokeWidth is 1.

    Examples

    The below examples shows, how to set StrokeWidth property of TreeMapLevel in the SfTreeMap.

    • XAML
    • C#
    • C#
    • C#
     <treemap:SfTreeMap x:Name="treeMap"
                        PrimaryValuePath="EmployeesCount"
                        DataSource="{Binding EmployeeDetails}">
       <treemap:SfTreeMap.BindingContext>
           <local:EmployeeViewModel />
       </treemap:SfTreeMap.BindingContext>
        <treemap:SfTreeMap.Levels>
       <treemap:TreeMapLevel GroupPath="Country"
                             Stroke="Gray"
                             StrokeWidth="1"/>
        </treemap:SfTreeMap.Levels>
      <treemap:SfTreeMap.LeafItemBrushSettings>
           <treemap:TreeMapUniformBrushSettings Brush="Orange">
           </treemap:TreeMapUniformBrushSettings>
       </treemap:SfTreeMap.LeafItemBrushSettings>
       <treemap:SfTreeMap.LeafItemSettings>
           <treemap:TreeMapLeafItemSettings LabelPath="JobDescription">
           </treemap:TreeMapLeafItemSettings>
       </treemap:SfTreeMap.LeafItemSettings>
    </treemap:SfTreeMap>
    public class EmployeeDetails
    {
       public string Category { get; set; }
       public string Country { get; set; }
       public string JobDescription { get; set; }
       public string JobGroup { get; set; }
       public int EmployeesCount { get; set; }
    }
    public class EmployeeViewModel
    {
        public EmployeeViewModel()
        {
           this.EmployeeDetails = new ObservableCollection<EmployeeDetails>()
           {
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 100 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 30 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 40 },
           };
        }
       public ObservableCollection<EmployeeDetails> EmployeeDetails
       {
           get;
           set;
        }
    }
    this.treeMap.Levels.Add(new TreeMapLevel() { GroupPath = "Country", Background = Brush.Green, StrokeWidth = 1 });
    See Also
    Background
    Stroke
    Spacing
    TextStyle
    HeaderHeight

    TextStyle

    Gets or sets the style of header item text, that used to customize the text color, font, font size, font family and font attributes.

    Declaration
    public TreeMapTextStyle TextStyle { get; set; }
    Property Value
    Type Description
    TreeMapTextStyle

    The default value of TextColor is Color.FromArgb("#49454F"), FontSize is 11, FontFamily is null, FontAttributes is Microsoft.Maui.Controls.FontAttributes.None

    Examples

    The below examples shows, how to set TextStyle property of TreeMapLevel in the SfTreeMap.

    • XAML
    • C#
    • C#
    • C#
     <treemap:SfTreeMap x:Name="treeMap"
                        PrimaryValuePath="EmployeesCount"
                        DataSource="{Binding EmployeeDetails}">
       <treemap:SfTreeMap.BindingContext>
           <local:EmployeeViewModel />
       </treemap:SfTreeMap.BindingContext>
       <treemap:SfTreeMap.Levels>
       <treemap:TreeMapLevel GroupPath="Country"
                             Stroke="Gray">
           <treemap:TreeMapLevel.TextStyle>
               <treemap:TreeMapTextStyle TextColor="Red"/>
           </treemap:TreeMapLevel.TextStyle>
         </treemap:TreeMapLevel>
       </treemap:SfTreeMap.Levels>
      <treemap:SfTreeMap.LeafItemBrushSettings>
           <treemap:TreeMapUniformBrushSettings Brush="Orange">
           </treemap:TreeMapUniformBrushSettings>
       </treemap:SfTreeMap.LeafItemBrushSettings>
       <treemap:SfTreeMap.LeafItemSettings>
           <treemap:TreeMapLeafItemSettings LabelPath="JobDescription">
           </treemap:TreeMapLeafItemSettings>
       </treemap:SfTreeMap.LeafItemSettings>
    </treemap:SfTreeMap>
    public class EmployeeDetails
    {
       public string Category { get; set; }
       public string Country { get; set; }
       public string JobDescription { get; set; }
       public string JobGroup { get; set; }
       public int EmployeesCount { get; set; }
    }
    public class EmployeeViewModel
    {
        public EmployeeViewModel()
        {
           this.EmployeeDetails = new ObservableCollection<EmployeeDetails>()
           {
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Technical", JobGroup = "Testers", EmployeesCount = 100 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "HR Executives", EmployeesCount = 30 },
               new EmployeeDetails() { Category = "Employees", Country = "India", JobDescription = "Accounts", EmployeesCount = 40 },
           };
        }
       public ObservableCollection<EmployeeDetails> EmployeeDetails
       {
           get;
           set;
        }
    }
    this.treeMap.Levels.Add(new TreeMapLevel() { GroupPath = "Country", Stroke = Brush.Gray, TextStyle = new TreeMapTextStyle() { TextColor = Colors.Red } });
    See Also
    Background
    Stroke
    StrokeWidth
    Spacing
    HeaderHeight

    Methods

    OnBindingContextChanged()

    Invokes on the binding context of the view changed.

    Declaration
    protected override void OnBindingContextChanged()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved