Class TreeMapLegendSettings
Represents settings for customizing the appearance of legend items in the SfTreeMap.
Inheritance
Namespace: Syncfusion.Maui.TreeMap
Assembly: Syncfusion.Maui.TreeMap.dll
Syntax
public class TreeMapLegendSettings : Element, IThemeElement
Constructors
TreeMapLegendSettings()
Initializes a new instance of the TreeMapLegendSettings class.
Declaration
public TreeMapLegendSettings()
Fields
IconSizeProperty
Identifies the IconSize dependency property.
Declaration
public static readonly BindableProperty IconSizeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for IconSize dependency property. |
IconTypeProperty
Identifies the IconType dependency property.
Declaration
public static readonly BindableProperty IconTypeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for IconType dependency property. |
ItemsLayoutProperty
Identifies the ItemsLayout dependency property.
Declaration
public static readonly BindableProperty ItemsLayoutProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for ItemsLayout dependency property. |
ItemTemplateProperty
Identifies the ItemTemplate dependency property.
Declaration
public static readonly BindableProperty ItemTemplateProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for ItemTemplate dependency property. |
PlacementProperty
Identifies the Placement dependency property.
Declaration
public static readonly BindableProperty PlacementProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Placement dependency property. |
ShowLegendProperty
Identifies the ShowLegend dependency property.
Declaration
public static readonly BindableProperty ShowLegendProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for ShowLegend dependency property. |
SizeProperty
Identifies the Size dependency property.
Declaration
public static readonly BindableProperty SizeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Size 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
IconSize
Gets or sets the size of the legend icons in the SfTreeMap.
Declaration
public Size IconSize { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | The default value of IconSize is new Size(16, 16). |
Remarks
This property will be applicable to only when the ShowLegend is enabled. The legend item text can be set using the LegendLabel property.
Examples
The below examples shows, how to set IconSize property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True"
IconSize="15,15"/>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
See Also
IconType
Gets or sets the type of icons to be used for the legend in the SfTreeMap.
Declaration
public LegendIconType IconType { get; set; }
Property Value
Type | Description |
---|---|
LegendIconType |
Remarks
This property will be applicable to only when the ShowLegend is enabled. The legend item text can be set using the LegendLabel property.
Examples
The below examples shows, how to set IconType property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True"
IconType="Diamond">
</treemap:TreeMapLegendSettings>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
See Also
ItemsLayout
Gets or sets the ItemsLayout of the legend within the SfTreeMap.
Declaration
public Layout ItemsLayout { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.Layout |
Examples
The below examples shows, how to set ItemsLayout property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.Resources>
<FlexLayout x:Key="legendLayout"
Padding="10,10,10,10">
</FlexLayout>
</treemap:SfTreeMap.Resources>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True"
ItemsLayout="{StaticResource legendLayout}">
</treemap:TreeMapLegendSettings>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
ItemTemplate
Gets or sets the ItemTemplate of the legend within the SfTreeMap.
Declaration
public DataTemplate ItemTemplate { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.DataTemplate |
Remarks
The BindingContext of the ItemTemplate is the LegendItem.
Examples
The below examples shows, how to set ItemTemplate property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.Resources>
<DataTemplate x:Key="legendTemplate">
<StackLayout Orientation="Horizontal">
<Rectangle HeightRequest="12"
WidthRequest="12" Margin="3"
Background="{Binding IconBrush}"/>
<Label Text="{Binding Text}"
Margin="3"/>
</StackLayout>
</DataTemplate>
</treemap:SfTreeMap.Resources>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True"
ItemTemplate="{StaticResource legendTemplate}">
</treemap:TreeMapLegendSettings>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
Placement
Gets or sets the placement of the legend with in the SfTreeMap.
Declaration
public LegendPlacement Placement { get; set; }
Property Value
Type | Description |
---|---|
LegendPlacement |
Remarks
This property will be applicable to only when the ShowLegend is enabled. The legend item text can be set using the LegendLabel property.
Examples
The below examples shows, how to set Placement property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True"
Placement="Left">
</treemap:TreeMapLegendSettings>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
See Also
ShowLegend
Gets or sets a value indicating whether the legend is enabled in the SfTreeMap.
Declaration
public bool ShowLegend { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value of ShowLegend is false/>. |
Remarks
true
if the legend is enabled; otherwise, false
.
The legend item text can be set using the LegendLabel property.
Examples
The below examples shows, how to set ShowLegend property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True">
</treemap:TreeMapLegendSettings>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
See Also
Size
Gets or sets the size of the legend layout in the SfTreeMap.
Declaration
public Size Size { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | The default size is calculated based on the legend placement. If the legend is placed at the top or bottom, the default height is set to 40 units, and the width is set to the layout width. If the legend is placed on the left or right side:
|
Remarks
This property will be applicable to only when the ShowLegend is enabled. The legend item text can be set using the LegendLabel property.
Examples
The below examples shows, how to set Size property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True"
Size="300,100">
</treemap:TreeMapLegendSettings>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
See Also
TextStyle
Gets or sets the style of legend 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 Microsoft.Maui.Graphics.Colors.Black, FontSize is 12, FontFamily is null, FontAttributes is Microsoft.Maui.Controls.FontAttributes.None |
Remarks
This property will be applicable to only when the ShowLegend is enabled. The legend item text can be set using the LegendLabel property.
Examples
The below examples shows, how to set TextStyle property of TreeMapLegendSettings in the SfTreeMap.
<treemap:SfTreeMap x:Name="treeMap"
PrimaryValuePath="EmployeesCount"
RangeColorValuePath="EmployeesCount"
DataSource="{Binding EmployeeDetails}">
<treemap:SfTreeMap.BindingContext>
<local:EmployeeViewModel />
</treemap:SfTreeMap.BindingContext>
<treemap:SfTreeMap.LegendSettings>
<treemap:TreeMapLegendSettings ShowLegend="True">
<treemap:TreeMapLegendSettings.TextStyle>
<treemap:TreeMapTextStyle TextColor="Orange" FontSize="14" FontAttributes="Italic"/>
</treemap:TreeMapLegendSettings.TextStyle>
</treemap:TreeMapLegendSettings>
</treemap:SfTreeMap.LegendSettings>
<treemap:SfTreeMap.LeafItemSettings>
<treemap:TreeMapLeafItemSettings LabelPath="JobDescription"
TextFormatOption="Wrap">
</treemap:TreeMapLeafItemSettings>
</treemap:SfTreeMap.LeafItemSettings>
<treemap:SfTreeMap.LeafItemBrushSettings>
<treemap:TreeMapRangeBrushSettings>
<treemap:TreeMapRangeBrushSettings.RangeBrushes>
<treemap:TreeMapRangeBrush LegendLabel="1 % Growth" From="1" To="50" Brush="#77D8D8" />
<treemap:TreeMapRangeBrush LegendLabel="2 % Growth" From="51" To="100" Brush="#AED960" />
</treemap:TreeMapRangeBrushSettings.RangeBrushes>
</treemap:TreeMapRangeBrushSettings>
</treemap:SfTreeMap.LeafItemBrushSettings>
</treemap:SfTreeMap>
See Also
Methods
OnBindingContextChanged()
Invokes on the binding context of the view changed.
Declaration
protected override void OnBindingContextChanged()