Class SfTreeGrid
Represents a SfTreeGrid control that displays hierarchical data in a tree structure with expandable and collapsible nodes.
Implements
Inherited Members
Namespace: Syncfusion.Maui.TreeGrid
Assembly: Syncfusion.Maui.TreeGrid.dll
Syntax
public class SfTreeGrid : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement
Constructors
SfTreeGrid()
Initializes a new instance of the SfTreeGrid class.
Declaration
public SfTreeGrid()
Fields
AllowDeletingProperty
Identifies the AllowDeleting Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowDeletingProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowDraggingColumnProperty
Identifies the AllowDraggingColumn Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowDraggingColumnProperty
Field Value
| Type |
|---|
| BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
AllowDraggingRowAnimationProperty
Identifies the AllowDraggingRowAnimation Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowDraggingRowAnimationProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowDraggingRowProperty
Identifies the AllowDraggingRow Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowDraggingRowProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowKeyboardNavigationProperty
Identifies the AllowKeyboardNavigation Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowKeyboardNavigationProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowLoadMoreProperty
Identifies the AllowLoadMore Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowLoadMoreProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowResizingColumnsProperty
Identifies the AllowResizingColumns Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowResizingColumnsProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowSearchingProperty
Identifies the AllowSearching Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowSearchingProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowSelectionOnExpanderClickProperty
Identifies the AllowSelectionOnExpanderClick Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowSelectionOnExpanderClickProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowSelectionOnPressProperty
Identifies the AllowSelectionOnPress Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowSelectionOnPressProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowSelectionOnSecondaryTapProperty
Identifies the AllowSelectionOnSecondaryTap Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowSelectionOnSecondaryTapProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowTriStateSortingProperty
Identifies the AllowTriStateSorting Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowTriStateSortingProperty
Field Value
| Type |
|---|
| BindableProperty |
AutoExpandModeProperty
Identifies the AutoExpandMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AutoExpandModeProperty
Field Value
| Type |
|---|
| BindableProperty |
AutoGenerateColumnsModeProperty
Identifies the AutoGenerateColumnsMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AutoGenerateColumnsModeProperty
Field Value
| Type |
|---|
| BindableProperty |
ChildPropertyNameProperty
Identifies the ChildPropertyName bindable property.
Declaration
public static readonly BindableProperty ChildPropertyNameProperty
Field Value
| Type |
|---|
| BindableProperty |
ColumnDragDropTemplateProperty
Identifies the ColumnDragDropTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ColumnDragDropTemplateProperty
Field Value
| Type |
|---|
| BindableProperty |
ColumnResizingModeProperty
Identifies the ColumnResizeMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ColumnResizingModeProperty
Field Value
| Type |
|---|
| BindableProperty |
Remarks
Valid values are OnTouchUp (default) for resize-on-release and OnMoved for real-time resize feedback.
ColumnWidthModeProperty
Identifies the ColumnWidthMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ColumnWidthModeProperty
Field Value
| Type |
|---|
| BindableProperty |
ColumnsProperty
Identifies the Columns Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ColumnsProperty
Field Value
| Type |
|---|
| BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
DefaultColumnWidthProperty
Identifies the DefaultColumnWidth Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty DefaultColumnWidthProperty
Field Value
| Type |
|---|
| BindableProperty |
DefaultStyleProperty
Identifies the DefaultStyle Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty DefaultStyleProperty
Field Value
| Type |
|---|
| BindableProperty |
EmptyViewProperty
Identifies the EmptyView Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty EmptyViewProperty
Field Value
| Type |
|---|
| BindableProperty |
EmptyViewTemplateProperty
Identifies the EmptyViewTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty EmptyViewTemplateProperty
Field Value
| Type |
|---|
| BindableProperty |
ExpandStateMappingNameProperty
Identifies the ExpandStateMappingName bindable property.
Declaration
public static readonly BindableProperty ExpandStateMappingNameProperty
Field Value
| Type |
|---|
| BindableProperty |
ExpanderColumnProperty
Identifies the ExpanderColumn Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ExpanderColumnProperty
Field Value
| Type |
|---|
| BindableProperty |
ExpanderIconProperty
Identifies the ExpanderIcon Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ExpanderIconProperty
Field Value
| Type |
|---|
| BindableProperty |
ExpanderWidthProperty
Identifies the ExpanderWidth Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ExpanderWidthProperty
Field Value
| Type |
|---|
| BindableProperty |
FilterLevelProperty
Identifies the FilterLevel Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty FilterLevelProperty
Field Value
| Type |
|---|
| BindableProperty |
FooterFrozenColumnCountProperty
Identifies the FooterFrozenColumnCount Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty FooterFrozenColumnCountProperty
Field Value
| Type |
|---|
| BindableProperty |
FrozenColumnCountProperty
Identifies the FrozenColumnCount Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty FrozenColumnCountProperty
Field Value
| Type |
|---|
| BindableProperty |
GridLinesVisibilityProperty
Identifies the GridLinesVisibility Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty GridLinesVisibilityProperty
Field Value
| Type |
|---|
| BindableProperty |
HeaderGridLinesVisibilityProperty
Identifies the HeaderGridLinesVisibility Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty HeaderGridLinesVisibilityProperty
Field Value
| Type |
|---|
| BindableProperty |
HeaderRowHeightProperty
Identifies the HeaderRowHeight Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty HeaderRowHeightProperty
Field Value
| Type |
|---|
| BindableProperty |
IsBusyProperty
Identifies the IsBusy Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty IsBusyProperty
Field Value
| Type |
|---|
| BindableProperty |
ItemsSourceProperty
Identifies the ItemsSource Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ItemsSourceProperty
Field Value
| Type |
|---|
| BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
LoadMoreCommandParameterProperty
Identifies the LoadMoreCommandParameter Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty LoadMoreCommandParameterProperty
Field Value
| Type |
|---|
| BindableProperty |
LoadMoreCommandProperty
Identifies the LoadMoreCommand Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty LoadMoreCommandProperty
Field Value
| Type |
|---|
| BindableProperty |
LoadMoreOptionProperty
Identifies the LoadMoreOption Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty LoadMoreOptionProperty
Field Value
| Type |
|---|
| BindableProperty |
LoadMorePositionProperty
Identifies the LoadMorePosition Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty LoadMorePositionProperty
Field Value
| Type |
|---|
| BindableProperty |
LoadMoreTextProperty
Identifies the LoadMoreText bindable property.
Declaration
public static readonly BindableProperty LoadMoreTextProperty
Field Value
| Type |
|---|
| BindableProperty |
LoadMoreViewProperty
Identifies the LoadMoreView Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty LoadMoreViewProperty
Field Value
| Type |
|---|
| BindableProperty |
NavigationModeProperty
Identifies the NavigationMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty NavigationModeProperty
Field Value
| Type |
|---|
| BindableProperty |
ParentPropertyNameProperty
Identifies the ParentPropertyName bindable property.
Declaration
public static readonly BindableProperty ParentPropertyNameProperty
Field Value
| Type |
|---|
| BindableProperty |
RowDragDropTemplateProperty
Identifies the RowDragDropTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty RowDragDropTemplateProperty
Field Value
| Type |
|---|
| BindableProperty |
RowHeightProperty
Identifies the RowHeight Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty RowHeightProperty
Field Value
| Type |
|---|
| BindableProperty |
SelectedIndexProperty
Identifies the SelectedIndex Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SelectedIndexProperty
Field Value
| Type |
|---|
| BindableProperty |
SelectedRowProperty
Identifies the SelectedRow Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SelectedRowProperty
Field Value
| Type |
|---|
| BindableProperty |
SelectedRowsProperty
Identifies the SelectedRow Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SelectedRowsProperty
Field Value
| Type |
|---|
| BindableProperty |
SelectionModeProperty
Identifies the SelectionMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SelectionModeProperty
Field Value
| Type |
|---|
| BindableProperty |
SelectionUnitProperty
Identifies the SelectionUnit Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SelectionUnitProperty
Field Value
| Type |
|---|
| BindableProperty |
SelfRelationRootValueProperty
Identifies the SelfRelationRootValue bindable property.
Declaration
public static readonly BindableProperty SelfRelationRootValueProperty
Field Value
| Type |
|---|
| BindableProperty |
ShowSortNumbersProperty
Identifies the ShowSortNumbers Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ShowSortNumbersProperty
Field Value
| Type |
|---|
| BindableProperty |
SortColumnDescriptionsProperty
Identifies the SortColumnDescriptionCollection Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SortColumnDescriptionsProperty
Field Value
| Type |
|---|
| BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
SortComparersProperty
Identifies the SortComparers Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SortComparersProperty
Field Value
| Type |
|---|
| BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
SortIconTemplateProperty
Identifies the SortIconTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SortIconTemplateProperty
Field Value
| Type |
|---|
| BindableProperty |
SortingGestureTypeProperty
Identifies the SortingGestureType Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SortingGestureTypeProperty
Field Value
| Type |
|---|
| BindableProperty |
SortingModeProperty
Identifies the SortingMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SortingModeProperty
Field Value
| Type |
|---|
| BindableProperty |
StackedHeaderRowsProperty
Identifies the StackedHeaderRows Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty StackedHeaderRowsProperty
Field Value
| Type |
|---|
| BindableProperty |
Properties
AllowDeleting
Gets or sets a value indicating whether Delete key can delete selected rows.
Declaration
public bool AllowDeleting { get; set; }
Property Value
| Type |
|---|
| bool |
Remarks
When set to true (the default), pressing the Delete key removes the selected records
from the SfTreeGrid. When set to false, the Delete key has no effect.
The default value is true.
AllowDraggingColumn
Gets or sets a value indicating whether the columns can be reordered through drag-and-drop.
Declaration
public bool AllowDraggingColumn { get; set; }
Property Value
| Type |
|---|
| bool |
Remarks
When enabled, the user can drag a column header and drop it over another column to reorder the columns. The QueryColumnDragging event is raised during the drag-and-drop operation, which can be used to cancel or customize the operation.
Examples
<syncfusion:SfTreeGrid AllowDraggingColumn = "True" />
AllowDraggingRow
Gets or sets a value indicating whether rows can be dragged and dropped. This is a bindable property.
Declaration
public bool AllowDraggingRow { get; set; }
Property Value
| Type |
|---|
| bool |
AllowDraggingRowAnimation
Gets or sets a value indicating whether the dragged row itself moves with the pointer instead of a drag view being shown. This is a bindable property.
Declaration
public bool AllowDraggingRowAnimation { get; set; }
Property Value
| Type |
|---|
| bool |
AllowKeyboardNavigation
Gets or sets a value indicating whether keyboard navigation is enabled in the SfTreeGrid.
Declaration
public bool AllowKeyboardNavigation { get; set; }
Property Value
| Type |
|---|
| bool |
Remarks
When enabled, the SfTreeGrid processes navigation key actions (arrow keys, Home, End,
PageUp, PageDown, Tab, and Ctrl key combinations) and moves the current cell or current row
accordingly, based on the NavigationMode. The default value is true.
AllowLoadMore
Gets or sets a value indicating whether the SfTreeGrid should load more data items on demand. This is a bindable property.
Declaration
public bool AllowLoadMore { get; set; }
Property Value
| Type |
|---|
| bool |
Remarks
When this property is enabled, the load more view is displayed, based on the LoadMoreOption value, when the grid is scrolled to the end of the records.
treeGrid.AllowLoadMore = true;
treeGrid.LoadMoreCommand = new Command(ExecuteLoadMoreCommand);
private async void ExecuteLoadMoreCommand()
{
viewModel.LoadMoreItems();
}
AllowResizingColumns
Gets or sets a value indicating whether the columns in the SfTreeGrid can be resized by dragging the column header edge.
Declaration
public bool AllowResizingColumns { get; set; }
Property Value
| Type |
|---|
| bool |
Examples
XAML
<syncfusion:SfTreeGrid AllowResizingColumns="True" />
AllowSearching
Gets or sets a value indicating whether the built-in searching is enabled in the tree grid.
Declaration
public bool AllowSearching { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Remarks
When set to true, the search toolbar is shown above the tree grid and the
SearchController can be used to search, navigate, and filter the records.
AllowSelectionOnExpanderClick
Gets or sets a value indicating whether the row or cell selection should be applied when the expander cell is tapped.
Declaration
public bool AllowSelectionOnExpanderClick { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | true if the selection is applied when the expander cell is tapped; otherwise, false. The default value is true. |
Remarks
When set to false, tapping the expander cell only performs the expand or
collapse operation of the node, and the row or cell selection is not changed,
matching the SfDataGrid selection handling patterns.
AllowSelectionOnPress
Gets or sets a value indicating whether the row or cell selection should be applied on pointer press instead of on tap release.
Declaration
public bool AllowSelectionOnPress { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | true if the selection is applied on pointer press; otherwise, false. The default value is false. |
Remarks
When set to true, the selection is processed as soon as the pointer is pressed
on a cell, instead of waiting for the tap gesture to complete. This improves the
selection responsiveness, particularly on mouse-driven platforms.
AllowSelectionOnSecondaryTap
Gets or sets a value indicating whether the row or cell selection should be applied when the cell is right clicked (secondary tap), before the context menu is shown.
Declaration
public bool AllowSelectionOnSecondaryTap { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | true if the selection is applied on secondary tap; otherwise, false. The default value is true. |
Remarks
This behavior is applicable on mouse-driven platforms (Windows and MacCatalyst),
where the secondary tap is a right click. When set to false, the selection
remains unchanged on right click.
AllowTriStateSorting
Gets or sets a value indicating whether tri-state sorting is enabled.
Declaration
public bool AllowTriStateSorting { get; set; }
Property Value
| Type |
|---|
| bool |
AutoExpandMode
Gets or sets the expand mode that determines how nodes are expanded when the grid is loaded.
Declaration
public TreeGridExpandMode AutoExpandMode { get; set; }
Property Value
| Type |
|---|
| TreeGridExpandMode |
AutoGenerateColumnsMode
Gets or sets the mode that determines how columns are automatically generated based on the data source.
Declaration
public AutoGenerateColumnsMode AutoGenerateColumnsMode { get; set; }
Property Value
| Type |
|---|
| AutoGenerateColumnsMode |
CellRenderers
Gets the collection of cell renderers used to render cells with specific data types or templates.
Declaration
public TreeGridCellRendererCollection CellRenderers { get; }
Property Value
| Type |
|---|
| TreeGridCellRendererCollection |
ChildPropertyName
Gets or sets the property name for the child collection used to determine the tree structure.
Declaration
public string ChildPropertyName { get; set; }
Property Value
| Type |
|---|
| string |
Remarks
This property defines which property in your data object holds the collection of child items. For nested collection mode, this is the only property required. For self-relational mode, use this together with ParentPropertyName.
ColumnDragDropTemplate
Gets or sets the Microsoft.Maui.Controls.DataTemplate that defines the appearance of the drag view displayed while dragging a column during the column drag-and-drop operation.
Declaration
public DataTemplate ColumnDragDropTemplate { get; set; }
Property Value
| Type |
|---|
| DataTemplate |
Remarks
The binding context of the template is the TreeGridColumn being dragged. A Microsoft.Maui.Controls.DataTemplateSelector can also be assigned to choose the template based on the dragged column.
Examples
<syncfusion:SfTreeGrid x:Name="treeGrid" AllowDraggingColumn = "True">
<syncfusion:SfTreeGrid.ColumnDragDropTemplate>
<DataTemplate>
<Label Text="{Binding HeaderText}" />
</DataTemplate>
</syncfusion:SfTreeGrid.ColumnDragDropTemplate>
</syncfusion:SfTreeGrid>
ColumnResizeMode
Gets or sets a value indicating the TreeGridColumnResizeMode for the resizing operation in a SfTreeGrid control.
Declaration
public TreeGridColumnResizeMode ColumnResizeMode { get; set; }
Property Value
| Type |
|---|
| TreeGridColumnResizeMode |
Remarks
OnTouchUp updates the column width when the resize gesture ends, while OnMoved updates the width continuously as the resizing indicator moves.
Examples
XAML
<syncfusion:SfTreeGrid AllowResizingColumns="True">
<syncfusion:SfTreeGrid.ColumnResizeMode>
syncfusion:TreeGridColumnResizeMode.OnMoved
</syncfusion:SfTreeGrid.ColumnResizeMode>
</syncfusion:SfTreeGrid>
ColumnSizer
Gets or sets the column sizer used to calculate and manage column widths.
Declaration
public TreeGridColumnSizer ColumnSizer { get; set; }
Property Value
| Type |
|---|
| TreeGridColumnSizer |
ColumnWidthMode
Gets or sets the mode that determines how column widths are automatically calculated.
Declaration
public TreeGridColumnWidthMode ColumnWidthMode { get; set; }
Property Value
| Type |
|---|
| TreeGridColumnWidthMode |
Columns
Gets or sets the collection of columns displayed by the control.
Declaration
public TreeGridColumnCollection Columns { get; set; }
Property Value
| Type |
|---|
| TreeGridColumnCollection |
CurrentCell
Gets the current cell position.
Declaration
public RowColumnIndex CurrentCell { get; set; }
Property Value
| Type |
|---|
| RowColumnIndex |
CurrentRow
Gets the current row data item.
Declaration
public object? CurrentRow { get; set; }
Property Value
| Type |
|---|
| object |
DefaultColumnWidth
Gets or sets the default width of columns in pixels.
Declaration
public double DefaultColumnWidth { get; set; }
Property Value
| Type |
|---|
| double |
DefaultStyle
Gets or sets the default style applied to the TreeGrid and its elements.
Declaration
public TreeGridStyle DefaultStyle { get; set; }
Property Value
| Type |
|---|
| TreeGridStyle |
Remarks
If this value is null, the built-in default style will be applied.
EmptyView
Gets or sets the content displayed when the SfTreeGrid has no records to display.
Declaration
public object? EmptyView { get; set; }
Property Value
| Type |
|---|
| object |
Remarks
A string is shown as text, a View is shown as is. Ignored when EmptyViewTemplate is set.
EmptyViewTemplate
Gets or sets the template used to render the empty view when the SfTreeGrid has no records to display.
Declaration
public DataTemplate? EmptyViewTemplate { get; set; }
Property Value
| Type |
|---|
| DataTemplate |
Remarks
When set, this takes precedence over EmptyView; the EmptyView value is used as the template's binding context.
ExpandStateMappingName
Gets or sets the property name that holds the expanded or collapsed state for each tree node.
Declaration
public string ExpandStateMappingName { get; set; }
Property Value
| Type |
|---|
| string |
Remarks
Set this to the name of a boolean property in your data object to automatically sync the expand/collapse
state with your data. The default value is string.Empty.
ExpanderColumn
Gets or sets the column name that will display the expand/collapse expander.
Declaration
public string ExpanderColumn { get; set; }
Property Value
| Type |
|---|
| string |
ExpanderIcon
Gets or sets the template that customizes the expand/collapse icon displayed in the expander column.
Declaration
public DataTemplate ExpanderIcon { get; set; }
Property Value
| Type |
|---|
| DataTemplate |
Remarks
When null, the default expand/collapse icon is used. The template receives a TreeNode
as its binding context, allowing you to bind to properties like IsExpanded, Level, and HasChildNodes.
ExpanderWidth
Gets or sets the width of the expander column.
Declaration
public double ExpanderWidth { get; set; }
Property Value
| Type |
|---|
| double |
FilterLevel
Gets or sets a value that indicates how nodes should be filtered using Filter.
Declaration
public FilterLevel FilterLevel { get; set; }
Property Value
| Type |
|---|
| FilterLevel |
FooterFrozenColumnCount
Gets or sets the number of columns to freeze on the right side of the grid.
Declaration
public int FooterFrozenColumnCount { get; set; }
Property Value
| Type |
|---|
| int |
Remarks
When set to a value greater than 0, the specified number of columns from the right will remain visible while scrolling horizontally. The default value is 0 (no frozen footer columns).
FrozenColumnCount
Gets or sets the number of columns to freeze on the left side of the grid.
Declaration
public int FrozenColumnCount { get; set; }
Property Value
| Type |
|---|
| int |
Remarks
When set to a value greater than 0, the specified number of columns from the left will remain visible while scrolling horizontally. The default value is 0 (no frozen columns).
GridLinesVisibility
Gets or sets the visibility of the grid lines for data rows.
Declaration
public TreeGridLinesVisibility GridLinesVisibility { get; set; }
Property Value
| Type |
|---|
| TreeGridLinesVisibility |
Remarks
Use HeaderGridLinesVisibility to customize the visibility of grid lines for column headers.
HeaderGridLinesVisibility
Gets or sets the visibility of the grid lines for column headers.
Declaration
public TreeGridLinesVisibility HeaderGridLinesVisibility { get; set; }
Property Value
| Type |
|---|
| TreeGridLinesVisibility |
Remarks
Use GridLinesVisibility to customize the visibility of grid lines for data rows.
HeaderRowHeight
Gets or sets the height of the header row in pixels.
Declaration
public double HeaderRowHeight { get; set; }
Property Value
| Type |
|---|
| double |
Remarks
The HeaderRowHeight is applied uniformly to the column header row and all the stacked header rows.
IsBusy
Gets or sets a value that indicates whether the SfTreeGrid is busy loading more items. This is a bindable property.
Declaration
public bool IsBusy { get; set; }
Property Value
| Type |
|---|
| bool |
Remarks
Set this property to true before starting a load more operation and to false once it is completed. While the grid is busy, further load more triggers are ignored, which prevents duplicate requests.
ItemsSource
Gets or sets the collection used to generate the content of the control.
Declaration
public object? ItemsSource { get; set; }
Property Value
| Type |
|---|
| object |
Remarks
Assign a data collection to this property to enable data binding and automatic item generation. The property supports any enumerable data source, such as arrays, lists, or observable collections. Changes to the collection may automatically update the displayed items, depending on the control's implementation.
LoadMoreCommand
Gets or sets the command that will be executed when the grid reaches the end of the records and AllowLoadMore is enabled. This is a bindable property.
Declaration
public ICommand? LoadMoreCommand { get; set; }
Property Value
| Type |
|---|
| ICommand |
Remarks
The LoadMoreCommandParameter is passed as the command parameter. If no parameter is set, the SfTreeGrid instance is passed instead.
LoadMoreCommandParameter
Gets or sets the parameter that will be passed to the LoadMoreCommand when it is executed. This is a bindable property.
Declaration
public object? LoadMoreCommandParameter { get; set; }
Property Value
| Type |
|---|
| object |
LoadMoreOption
Gets or sets how the load more operation should be triggered in SfTreeGrid. This is a bindable property.
Declaration
public TreeGridLoadMoreOption LoadMoreOption { get; set; }
Property Value
| Type |
|---|
| TreeGridLoadMoreOption |
Remarks
The default value is Manual, which loads more items only when the user taps the load more button.
LoadMorePosition
Gets or sets the position of the load more view in SfTreeGrid. This is a bindable property.
Declaration
public TreeGridLoadMorePosition LoadMorePosition { get; set; }
Property Value
| Type |
|---|
| TreeGridLoadMorePosition |
Remarks
The default value is Bottom.
LoadMoreText
Gets or sets the text that will be displayed in the load more button of the load more view. This is a bindable property.
Declaration
public string LoadMoreText { get; set; }
Property Value
| Type |
|---|
| string |
Remarks
The default text is "Load More".
LoadMoreView
Gets or sets the TreeGridLoadMoreView that is displayed at the top or bottom of the SfTreeGrid when AllowLoadMore is enabled. This is a bindable property.
Declaration
public TreeGridLoadMoreView LoadMoreView { get; set; }
Property Value
| Type |
|---|
| TreeGridLoadMoreView |
Remarks
A custom load more view can be assigned to customize the default appearance.
NavigationMode
Gets or sets the navigation mode that determines whether navigation is performed on row or cell level.
Declaration
public TreeGridNavigationMode NavigationMode { get; set; }
Property Value
| Type | Description |
|---|---|
| TreeGridNavigationMode | One of the TreeGridNavigationMode enumeration values. The default value is Cell, in which the cell acts as the focused element. When set to Row, the entire row becomes active and navigation moves between individual cells. |
ParentPropertyName
Gets or sets the property name for the parent object used to determine the tree structure in self-relational mode.
Declaration
public string ParentPropertyName { get; set; }
Property Value
| Type |
|---|
| string |
Remarks
This property defines which property in your data object holds the reference to the parent item. Use this together with ChildPropertyName for self-relational hierarchies. It should be unique within your data structure.
RowDragDropController
Gets or sets the TreeGridRowDragDropController that owns the row drag and drop behavior of the SfTreeGrid. This is a bindable property.
Declaration
public TreeGridRowDragDropController? RowDragDropController { get; set; }
Property Value
| Type |
|---|
| TreeGridRowDragDropController |
Remarks
The controller exposes the auto-expand settings (CanAutoExpand and AutoExpandDelay) and the current drag state, and can be replaced with a derived controller to customize the drop handling.
RowDragDropTemplate
Gets or sets whether rows can be dragged and dropped to reorder or re-parent them. Long-press on touch, press-drag on pointer; drop as sibling or child. This is a bindable property.
Declaration
public DataTemplate? RowDragDropTemplate { get; set; }
Property Value
| Type |
|---|
| DataTemplate |
Remarks
When a custom template is set, the dragged-rows count badge is not rendered on the drag view.
RowHeight
Gets or sets the height of data rows in pixels.
Declaration
public double RowHeight { get; set; }
Property Value
| Type |
|---|
| double |
SearchController
Gets the search controller that provides the implementation for searching the records in the tree grid.
Declaration
public TreeGridSearchController SearchController { get; set; }
Property Value
| Type | Description |
|---|---|
| TreeGridSearchController | The TreeGridSearchController instance of the tree grid. |
SelectedIndex
Gets the index of the currently selected row.
Declaration
public int SelectedIndex { get; set; }
Property Value
| Type |
|---|
| int |
SelectedRow
Gets the data item of the currently selected row.
Declaration
public object? SelectedRow { get; set; }
Property Value
| Type |
|---|
| object |
SelectedRows
Gets a list of all selected row data items.
Declaration
public ObservableCollection<object> SelectedRows { get; set; }
Property Value
| Type |
|---|
| ObservableCollection<object> |
SelectionController
Gets the selection controller that manages row selection state and operations.
Declaration
public TreeGridSelectionController? SelectionController { get; set; }
Property Value
| Type |
|---|
| TreeGridSelectionController |
SelectionMode
Gets or sets the row selection mode.
Declaration
public TreeGridSelectionMode SelectionMode { get; set; }
Property Value
| Type |
|---|
| TreeGridSelectionMode |
SelectionUnit
Gets or sets a value that indicates whether the selection is performed on row or cell level.
Declaration
public TreeGridSelectionUnit SelectionUnit { get; set; }
Property Value
| Type | Description |
|---|---|
| TreeGridSelectionUnit | One of the TreeGridSelectionUnit enumeration values. The default value is Row. |
Remarks
When set to Row, selecting any cell selects the entire row, which is the default behavior. When set to Cell, selecting a cell selects only that cell, and the NavigationMode must be Cell since cell selection requires cell-level navigation.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when Cell is set while NavigationMode is Row, or when NavigationMode is set to Row while the selection unit is not Row. |
SelfRelationRootValue
Gets or sets the value that defines the root object in self-relational mode.
Declaration
public object SelfRelationRootValue { get; set; }
Property Value
| Type |
|---|
| object |
Remarks
In self-relational mode, this value is used to identify root-level items (items whose parent
property matches this value). The default value is null.
ShowSortNumbers
Gets or sets a value indicating whether the ordinal sort order numbers are displayed next to the sort indicator in column headers when multi-column sorting is enabled.
Declaration
public bool ShowSortNumbers { get; set; }
Property Value
| Type |
|---|
| bool |
SortColumnDescriptions
Gets or sets the collection of the sort descriptions of columns that are sorted.
Declaration
public SortColumnDescriptionCollection SortColumnDescriptions { get; set; }
Property Value
| Type |
|---|
| SortColumnDescriptionCollection |
SortComparers
Gets the collection of custom comparers used to sort columns based on custom logic.
Declaration
public SortComparers SortComparers { get; }
Property Value
| Type |
|---|
| SortComparers |
SortIconTemplate
Gets or sets a custom Microsoft.Maui.Controls.DataTemplate used to render the sort indicator (the up/down arrow) in column headers.
Declaration
public DataTemplate? SortIconTemplate { get; set; }
Property Value
| Type |
|---|
| DataTemplate |
SortingGestureType
Gets or sets the gesture that triggers sorting when a column header is interacted with.
Declaration
public TreeGridSortingGestureType SortingGestureType { get; set; }
Property Value
| Type |
|---|
| TreeGridSortingGestureType |
SortingMode
Gets or sets the value that decides whether sorting is enabled and whether single or multiple columns can be sorted in a SfTreeGrid.
Declaration
public TreeGridSortingMode SortingMode { get; set; }
Property Value
| Type | Description |
|---|---|
| TreeGridSortingMode | One of the TreeGridSortingMode enumeration values. The default value is None, which disables sorting. |
StackedHeaderRows
Gets or sets the collection of TreeGridStackedHeaderRow to add additional headers to group the column headers.
Declaration
public ObservableCollection<TreeGridStackedHeaderRow> StackedHeaderRows { get; set; }
Property Value
| Type |
|---|
| ObservableCollection<TreeGridStackedHeaderRow> |
Remarks
The HeaderRowHeight is applied to all the stacked header rows.
Examples
<treegrid:SfTreeGrid.StackedHeaderRows>
<treegrid:TreeGridStackedHeaderRow>
<treegrid:TreeGridStackedHeaderRow.Columns>
<treegrid:TreeGridStackedColumn
ColumnMappingNames = "ID,Name"
Text="Employee Details" />
</treegrid:TreeGridStackedHeaderRow.Columns>
</treegrid:TreeGridStackedHeaderRow>
</treegrid:SfTreeGrid.StackedHeaderRows>
SfTreeGrid treeGrid = new SfTreeGrid();
var stackedHeaderRow = new TreeGridStackedHeaderRow();
stackedHeaderRow.Columns.Add(new TreeGridStackedColumn()
{
ColumnMappingNames = "ID,Name",
Text = "Employee Details",
});
treeGrid.StackedHeaderRows.Add(stackedHeaderRow);
View
Gets or sets the TreeGridView that provides the hierarchical data and structure for the grid.
Declaration
public TreeGridView? View { get; set; }
Property Value
| Type |
|---|
| TreeGridView |
VisualContainer
Gets the visual container that manages the rendering and layout of grid rows and columns.
Declaration
public VisualContainer VisualContainer { get; }
Property Value
| Type |
|---|
| VisualContainer |
Methods
ArrangeContent(Rect)
Arranges the content of the element within the specified bounds.
Declaration
protected override Size ArrangeContent(Rect bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | bounds | The rectangle that defines the area within which to arrange the content. |
Returns
| Type | Description |
|---|---|
| Size | A Size structure representing the actual size used to arrange the content. |
Overrides
ClearSelection()
Clears all selected rows and cells.
Declaration
public void ClearSelection()
CollapseAllNodes()
Collapses all the nodes in SfTreeGrid.
Declaration
public void CollapseAllNodes()
CollapseAllNodes(TreeNode)
Collapses the particular node and all its child nodes in SfTreeGrid.
Declaration
public void CollapseAllNodes(TreeNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeNode | node | Specifies which node to be collapsed. |
CollapseNode(TreeNode)
Collapses the particular node in SfTreeGrid.
Declaration
public void CollapseNode(TreeNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeNode | node | Specifies which node to be collapsed. |
CollapseNode(int)
Collapses the node in particular rowIndex.
Declaration
public void CollapseNode(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | Specifies the row index which contains the node to be collapsed. |
ExpandAllNodes()
Expands all the nodes in SfTreeGrid.
Declaration
public void ExpandAllNodes()
ExpandAllNodes(TreeNode)
Expands the particular node and all its child nodes in SfTreeGrid.
Declaration
public void ExpandAllNodes(TreeNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeNode | node | Specifies which node to be expanded. |
ExpandAllNodes(int)
Expands all the nodes in SfTreeGrid up to given level.
Declaration
public void ExpandAllNodes(int level)
Parameters
| Type | Name | Description |
|---|---|---|
| int | level | Specifies how many levels to be expanded. |
ExpandNode(TreeNode)
Expands the particular node in SfTreeGrid.
Declaration
public void ExpandNode(TreeNode node)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeNode | node | Specifies which node to be expanded. |
ExpandNode(int)
Expands the node in particular rowIndex.
Declaration
public void ExpandNode(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | Specifies the row index which contains the node to be expanded. |
GetRecordAtRowIndex(int)
Gets the underlying data object at the specified row index in the SfTreeGrid.
Declaration
public object? GetRecordAtRowIndex(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | The row index of the record, including any header rows. |
Returns
| Type | Description |
|---|---|
| object | The underlying data object at the given row index; otherwise, null when the row index does not refer to a visible tree node. |
Remarks
The row index includes the header row, matching the row index used by the selection,
current cell and navigation APIs. For example, the first data row below the header is
resolved through GetHeaderIndex() + 1.
GetSelectedCellInfo(RowColumnIndex)
Gets the TreeGridCellInfo of the cell at the specified row and column index when SelectionUnit is Cell.
Declaration
public TreeGridCellInfo? GetSelectedCellInfo(RowColumnIndex rowColumnIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
Returns
| Type | Description |
|---|---|
| TreeGridCellInfo | The TreeGridCellInfo of the cell at the specified row and column index; otherwise, null when the position does not refer to a valid data cell. |
GetSelectedCells()
Gets the collection of currently selected cells when SelectionUnit is Cell.
Declaration
public IList<TreeGridCellInfo> GetSelectedCells()
Returns
| Type | Description |
|---|---|
| IList<TreeGridCellInfo> | The list of TreeGridCellInfo with one item per selected cell, containing the complete cell information such as the column, row data, node entry and row index. Returns an empty collection when no cells are selected or when SelectionUnit is not Cell. |
HandleHyperlinkNavigation(string, RowColumnIndex, object)
Handles hyperlink navigation for a cell in the SfTreeGrid.
Declaration
public void HandleHyperlinkNavigation(string text, RowColumnIndex rowColumnIndex, object rowData)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The hyperlink text to navigate to. |
| RowColumnIndex | rowColumnIndex | The row and column index of the cell being navigated. |
| object | rowData | The data item associated with the cell. |
MeasureContent(double, double)
Measures the size required for the content, given the specified width and height constraints.
Declaration
protected override Size MeasureContent(double widthConstraint, double heightConstraint)
Parameters
| Type | Name | Description |
|---|---|---|
| double | widthConstraint | The maximum width. |
| double | heightConstraint | The maximum height. |
Returns
| Type | Description |
|---|---|
| Size | A Size structure representing the width and height required to display the content within the specified constraints. |
Overrides
MoveCurrentCellTo(RowColumnIndex, bool)
Moves the current cell to the specified row and column index.
Declaration
public void MoveCurrentCellTo(RowColumnIndex rowColumnIndex, bool needToClearSelection = true)
Parameters
| Type | Name | Description |
|---|---|---|
| RowColumnIndex | rowColumnIndex | The row and column index to move the current cell to. |
| bool | needToClearSelection | A value indicating whether the existing selection should be cleared when the current cell is moved. |
Remarks
The current cell will not be moved when SelectionMode is None or when NavigationMode is Row. The specified cell will be scrolled into view if it is not currently visible.
MoveToNextCell()
Navigates to the next cell in sequential order, moving to the first cell of the next row when at the last column. This method mimics the Tab key behavior and respects the current NavigationMode setting.
Declaration
public void MoveToNextCell()
Remarks
This method is only applicable when NavigationMode is set to Cell. If called when NavigationMode is Row, this method performs no operation.
MoveToNextRow()
Navigates to the next row while maintaining the current column index. This method respects the current NavigationMode setting.
Declaration
public void MoveToNextRow()
Remarks
This method navigates to the next row in both Cell and Row navigation modes. In Cell mode, the column index is preserved; in Row mode, navigation is to the entire row.
MoveToPreviousCell()
Navigates to the previous cell in sequential order, moving to the last cell of the previous row when at the first column. This method mimics the Shift+Tab key behavior and respects the current NavigationMode setting.
Declaration
public void MoveToPreviousCell()
Remarks
This method is only applicable when NavigationMode is set to Cell. If called when NavigationMode is Row, this method performs no operation.
MoveToPreviousRow()
Navigates to the previous row while maintaining the current column index. This method respects the current NavigationMode setting.
Declaration
public void MoveToPreviousRow()
Remarks
This method navigates to the previous row in both Cell and Row navigation modes. In Cell mode, the column index is preserved; in Row mode, navigation is to the entire row.
OnCommonThemeChanged(string, string)
Called when the common theme has changed.
Declaration
public void OnCommonThemeChanged(string oldTheme, string newTheme)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldTheme | The old theme name. |
| string | newTheme | The new theme name. |
OnControlThemeChanged(string, string)
Called when the control theme has changed.
Declaration
public void OnControlThemeChanged(string oldTheme, string newTheme)
Parameters
| Type | Name | Description |
|---|---|---|
| string | oldTheme | The old theme name. |
| string | newTheme | The new theme name. |
OnDraw(ICanvas, RectF)
Draws the column resizing indicator when the column resizing is in progress.
Declaration
protected override void OnDraw(ICanvas canvas, RectF dirtyRect)
Parameters
| Type | Name | Description |
|---|---|---|
| ICanvas | canvas | The canvas used to draw the indicator. |
| RectF | dirtyRect | The dirty rectangle that needs to be redrawn. |
Overrides
OnHandlerChanged()
Wires the platform-level pointer interactions required for the column resizing operation when the SfTreeGrid handler is created, following the SfDataGrid interaction architecture.
Declaration
protected override void OnHandlerChanged()
Overrides
OnPropertyChanged(string)
Called when a property on this element has changed.
Declaration
protected override void OnPropertyChanged(string propertyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName | The name of the property that changed. |
SelectAll()
Selects all rows in multiple-selection mode.
Declaration
public void SelectAll()
SelectCell(object?, TreeGridColumn?)
Selects the specified cell when SelectionUnit is Cell.
Declaration
public void SelectCell(object? rowData, TreeGridColumn? column)
Parameters
| Type | Name | Description |
|---|---|---|
| object | rowData | The underlying data object of the row that contains the cell to select. |
| TreeGridColumn | column | The TreeGridColumn of the cell to select. |
Remarks
The selected cell becomes the current cell and the UI refreshes immediately. This method is applicable only when SelectionUnit is Cell.
SelectCells(object?, TreeGridColumn?, object?, TreeGridColumn?)
Selects the range of cells specified by the start row data, start column, end row data and end column when SelectionUnit is Cell.
Declaration
public void SelectCells(object? startRowData, TreeGridColumn? startColumn, object? endRowData, TreeGridColumn? endColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| object | startRowData | The underlying data object of the row that contains the first cell in the range. |
| TreeGridColumn | startColumn | The TreeGridColumn of the first cell in the range. |
| object | endRowData | The underlying data object of the row that contains the last cell in the range. |
| TreeGridColumn | endColumn | The TreeGridColumn of the last cell in the range. |
Remarks
All cells within the range become selected. This method is applicable only when SelectionUnit is Cell.
UnWireEvents()
Unwires the events associated with the TreeGrid.
Declaration
protected virtual void UnWireEvents()
WireEvents()
Wires the events associated with the TreeGrid.
Declaration
protected virtual void WireEvents()
Events
AutoGeneratingColumn
Occurs when a column is being auto-generated for a property in the underlying data source.
Declaration
public event EventHandler<TreeGridAutoGeneratingColumnEventArgs>? AutoGeneratingColumn
Event Type
| Type |
|---|
| EventHandler<TreeGridAutoGeneratingColumnEventArgs> |
Remarks
This event allows you to customize, replace, or cancel the column that is automatically
generated by the SfTreeGrid for each property of the bound items. Set the
Column to a different column type to
customize the column, or set Cancel
to true to skip generating a column for the current property.
ColumnResizing
Occurs when a column in the SfTreeGrid is being resized by dragging the column header edge.
Declaration
public event EventHandler<TreeGridColumnResizingEventArgs>? ColumnResizing
Event Type
| Type |
|---|
| EventHandler<TreeGridColumnResizingEventArgs> |
Remarks
Handle this event to cancel the resize operation by setting
TreeGridColumnResizingEventArgs.Cancel to true in the event handler.
Examples
treeGrid.ColumnResizing += TreeGrid_ColumnResizing;
void TreeGrid_ColumnResizing(object sender, TreeGridColumnResizingEventArgs e)
{
if (e.ResizingState == TreeGridProgressState.Starting && e.Index == 0)
{
e.Cancel = true;
}
}
CurrentCellActivated
Occurs after the current cell changes.
Declaration
public event EventHandler<TreeGridCurrentCellActivatedEventArgs>? CurrentCellActivated
Event Type
| Type |
|---|
| EventHandler<TreeGridCurrentCellActivatedEventArgs> |
CurrentCellActivating
Occurs before the current cell changes.
Declaration
public event EventHandler<TreeGridCurrentCellActivatingEventArgs>? CurrentCellActivating
Event Type
| Type |
|---|
| EventHandler<TreeGridCurrentCellActivatingEventArgs> |
CurrentCellRequestNavigating
Occurs when a hyperlink cell is tapped, allowing developers to handle navigation or cancel the action.
Declaration
public event EventHandler<TreeGridCurrentCellRequestNavigatingEventArgs>? CurrentCellRequestNavigating
Event Type
| Type |
|---|
| EventHandler<TreeGridCurrentCellRequestNavigatingEventArgs> |
Remarks
This event is raised when a user taps a hyperlink cell in a TreeGridHyperlinkColumn.
Developers can use this event to implement custom navigation logic or cancel the action by setting
the TreeGridCurrentCellRequestNavigatingEventArgs.Cancel property to true.
ItemsSourceChanged
Occurs when the items source of the SfTreeGrid is changed.
Declaration
public event EventHandler<TreeGridItemsSourceChangedEventArgs>? ItemsSourceChanged
Event Type
| Type |
|---|
| EventHandler<TreeGridItemsSourceChangedEventArgs> |
NodeCollapsed
Occurs after a tree node has been collapsed.
Declaration
public event EventHandler<TreeGridNodeCollapsedEventArgs>? NodeCollapsed
Event Type
| Type |
|---|
| EventHandler<TreeGridNodeCollapsedEventArgs> |
NodeCollapsing
Occurs when a tree node is being collapsed.
Declaration
public event EventHandler<TreeGridNodeCollapsingEventArgs>? NodeCollapsing
Event Type
| Type |
|---|
| EventHandler<TreeGridNodeCollapsingEventArgs> |
Remarks
Handle this event to cancel a node collapse by setting TreeGridNodeCollapsingEventArgs.Cancel
to true in the event handler.
NodeExpanded
Occurs after a tree node has been expanded.
Declaration
public event EventHandler<TreeGridNodeExpandedEventArgs>? NodeExpanded
Event Type
| Type |
|---|
| EventHandler<TreeGridNodeExpandedEventArgs> |
NodeExpanding
Occurs when a tree node is being expanded.
Declaration
public event EventHandler<TreeGridNodeExpandingEventArgs>? NodeExpanding
Event Type
| Type |
|---|
| EventHandler<TreeGridNodeExpandingEventArgs> |
Remarks
Handle this event to cancel a node expansion by setting TreeGridNodeExpandingEventArgs.Cancel
to true in the event handler.
QueryColumnDragging
Occurs when a column is dragged to another position in the SfTreeGrid, allowing the drag to be canceled or customized.
Declaration
public event EventHandler<TreeGridQueryColumnDraggingEventArgs>? QueryColumnDragging
Event Type
| Type |
|---|
| EventHandler<TreeGridQueryColumnDraggingEventArgs> |
Remarks
The event is raised continuously during the column drag-and-drop operation, with
DragStarted when the drag begins,
Dragging while the column is being dragged and
DragEnded when the column is dropped.
Handle this event to cancel the drag operation by setting
TreeGridQueryColumnDraggingEventArgs.Cancel to true, or to disable
auto-scrolling by setting CanAutoScroll to false.
Examples
treeGrid.QueryColumnDragging += TreeGrid_QueryColumnDragging;
void TreeGrid_QueryColumnDragging(object sender, TreeGridQueryColumnDraggingEventArgs e)
{
if (e.From == 2)
{
e.Cancel = true;
}
if (e.To == 0)
{
e.CanAutoScroll = false;
}
}
QueryRowDragging
Gets or sets event raised during row drag/drop to customize or cancel at each lifecycle stage. Cancel at DragStarted to prevent drag; during Dragging to mark target invalid; at DragEnded to cancel drop.
Declaration
public event EventHandler<TreeGridQueryRowDraggingEventArgs>? QueryRowDragging
Event Type
| Type |
|---|
| EventHandler<TreeGridQueryRowDraggingEventArgs> |
QueryRowHeight
Occurs when the height of a row is queried, allowing the height of individual rows to be customized at runtime.
Set TreeGridQueryRowHeightEventArgs.Handled to true and assign
Height to apply a custom height for the row.
Declaration
public event EventHandler<TreeGridQueryRowHeightEventArgs>? QueryRowHeight
Event Type
| Type |
|---|
| EventHandler<TreeGridQueryRowHeightEventArgs> |
Remarks
The event is raised for visible rows during loading, scrolling, and whenever the row structure changes (expand, collapse, and source collection changes). Use GetRowHeight(SfTreeGrid, int, bool, List<string>?) inside the handler to auto-fit the row height based on its content.
SelectionChanged
Occurs after a row selection has changed.
Declaration
public event EventHandler<TreeGridSelectionChangedEventArgs>? SelectionChanged
Event Type
| Type |
|---|
| EventHandler<TreeGridSelectionChangedEventArgs> |
SelectionChanging
Occurs before a row selection changes.
Declaration
public event EventHandler<TreeGridSelectionChangingEventArgs>? SelectionChanging
Event Type
| Type |
|---|
| EventHandler<TreeGridSelectionChangingEventArgs> |
SortColumnsChanged
Occurs after the SortColumnDescriptions collection has been changed.
Declaration
public event EventHandler<TreeGridSortColumnsChangedEventArgs>? SortColumnsChanged
Event Type
| Type |
|---|
| EventHandler<TreeGridSortColumnsChangedEventArgs> |
SortColumnsChanging
Occurs before the SortColumnDescriptions collection is changed, allowing the change to be canceled.
Declaration
public event EventHandler<TreeGridSortColumnsChangingEventArgs>? SortColumnsChanging
Event Type
| Type |
|---|
| EventHandler<TreeGridSortColumnsChangingEventArgs> |
TreeGridLoaded
Occurs when the SfTreeGrid is fully loaded and ready for interaction.
Declaration
public event EventHandler? TreeGridLoaded
Event Type
| Type |
|---|
| EventHandler |