Skip to main content

HierarchicalTreeDataGridSource<TModel> Class

Definition

Assembly:Avalonia.Controls.TreeDataGrid
Package:Avalonia.Controls.TreeDataGrid

A data source for a Avalonia.Controls.TreeDataGrid which displays a hierarchial tree where each row may have multiple columns.

public class HierarchicalTreeDataGridSource<TModel>

Inheritance: object -> NotifyingBase -> HierarchicalTreeDataGridSource<TModel>

Implements: ITreeDataGridSource, ITreeDataGridSource<>, IExpanderRowController<>, INotifyPropertyChanged, IDisposable

Constructors

NameDescription
HierarchicalTreeDataGridSource<TModel> (2 overloads)No summary available.

HierarchicalTreeDataGridSource<TModel> overloads

HierarchicalTreeDataGridSource<TModel> Constructor

public HierarchicalTreeDataGridSource<TModel>(System.Collections.Generic.IEnumerable<TModel> items)
Parameters

items System.Collections.Generic.IEnumerable<TModel>

HierarchicalTreeDataGridSource<TModel> Constructor

Initializes a new instance of the Avalonia.Controls.HierarchicalTreeDataGridSource<T> class with a single root item.

public HierarchicalTreeDataGridSource<TModel>(TModel item)
Parameters

item TModel

The root item to display.

Methods

NameDescription
ClearSortClears any sorting applied to the specified column.
CollapseCollapses the row at the specified index.
CollapseAllCollapses all rows.
DisposeNo summary available.
ExpandExpands the row at the specified index.
ExpandAllExpands all rows.
ExpandCollapseRecursive (2 overloads)No summary available.
FilterNo summary available.
RefreshFilterRefreshes the current filter applied to the collection.
SortNo summary available.
SortByRequests to sort the source by the specified column.
TryGetModelAtNo summary available.

ClearSort Method

Clears any sorting applied to the specified column.

public void ClearSort(Avalonia.Controls.Models.TreeDataGrid.IColumn column)

Parameters

column Avalonia.Controls.Models.TreeDataGrid.IColumn

The column.

Collapse Method

Collapses the row at the specified index.

public void Collapse(Avalonia.Controls.IndexPath index)

Parameters

index Avalonia.Controls.IndexPath

The index path of the row to collapse.

CollapseAll Method

Collapses all rows.

public void CollapseAll()

Dispose Method

public void Dispose()

Expand Method

Expands the row at the specified index.

public void Expand(Avalonia.Controls.IndexPath index)

Parameters

index Avalonia.Controls.IndexPath

The index path of the row to expand.

ExpandAll Method

Expands all rows.

public void ExpandAll()

ExpandCollapseRecursive overloads

ExpandCollapseRecursive Method

public void ExpandCollapseRecursive(Avalonia.Controls.Models.TreeDataGrid.HierarchicalRow<TModel><TModel> row, Func<TModel, bool> predicate)
Parameters

row Avalonia.Controls.Models.TreeDataGrid.HierarchicalRow<TModel><TModel>

predicate Func<TModel, bool>

ExpandCollapseRecursive Method

public void ExpandCollapseRecursive(Func<TModel, bool> predicate)
Parameters

predicate Func<TModel, bool>

Filter Method

public void Filter(Func<TModel, bool> filter)

Parameters

filter Func<TModel, bool>

RefreshFilter Method

Refreshes the current filter applied to the collection.

public void RefreshFilter()

Remarks

Call this method if the filter predicate depends on external state which has changed, to re-apply the filter to the collection.

Sort Method

public void Sort(Comparison<TModel> comparison)

Parameters

comparison Comparison<TModel>

SortBy Method

Requests to sort the source by the specified column.

public bool SortBy(Avalonia.Controls.Models.TreeDataGrid.IColumn column, System.ComponentModel.ListSortDirection direction)

Parameters

column Avalonia.Controls.Models.TreeDataGrid.IColumn

The column.

direction System.ComponentModel.ListSortDirection

The sort direction.

Returns

bool

True if the sort could be performed; otherwise false.

TryGetModelAt Method

public bool TryGetModelAt(Avalonia.Controls.IndexPath index, TModel& result)

Parameters

index Avalonia.Controls.IndexPath

result TModel&

Returns

bool

Properties

NameDescription
CellSelectionGets the cell selection model if cell selection is being used.
ColumnsGets the columns to be displayed.
IsFilteredGets a value indicating whether the data source is filtered.
IsHierarchicalGets a value indicating whether the data source is hierarchical.
IsSortedGets a value indicating whether the data source is currently sorted.
ItemsGets the items in the data source.
RowSelectionGets the row selection model if row selection is being used.
RowsGets the rows to be displayed.
SelectionGets or sets the selection model.

CellSelection Property

Gets the cell selection model if cell selection is being used.

public Avalonia.Controls.Selection.ITreeDataGridCellSelectionModel<T><TModel> CellSelection { get; set; }

Remarks

This property is equivalent to casting the Avalonia.Controls.HierarchicalTreeDataGridSource<T>.Selection property to Avalonia.Controls.Selection.ITreeDataGridCellSelectionModel<T>.

Columns Property

Gets the columns to be displayed.

public Avalonia.Controls.Models.TreeDataGrid.ColumnList<TModel><TModel> Columns { get; set; }

IsFiltered Property

Gets a value indicating whether the data source is filtered.

public bool IsFiltered { get; set; }

IsHierarchical Property

Gets a value indicating whether the data source is hierarchical.

public bool IsHierarchical { get; set; }

IsSorted Property

Gets a value indicating whether the data source is currently sorted.

public bool IsSorted { get; set; }

Items Property

Gets the items in the data source.

public System.Collections.Generic.IEnumerable<TModel> Items { get; set; }

RowSelection Property

Gets the row selection model if row selection is being used.

public Avalonia.Controls.Selection.ITreeDataGridRowSelectionModel<T><TModel> RowSelection { get; set; }

Remarks

This property is equivalent to casting the Avalonia.Controls.HierarchicalTreeDataGridSource<T>.Selection property to Avalonia.Controls.Selection.ITreeDataGridRowSelectionModel<T>.

Rows Property

Gets the rows to be displayed.

public Avalonia.Controls.Models.TreeDataGrid.IRows Rows { get; set; }

Selection Property

Gets or sets the selection model.

public Avalonia.Controls.Selection.ITreeDataGridSelection Selection { get; set; }

Remarks

The selection mode of the control may be changed by setting this property to either an instance of Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<T> for row selection, or Avalonia.Controls.Selection.TreeDataGridCellSelectionModel<T> for cell selection.

Events

NameDescription
RowCollapsedOccurs when a hierarchical row is collapsed.
RowCollapsingOccurs when a hierarchical row is about to collapse.
RowExpandedOccurs when a row in the hierarchical data structure is expanded.
RowExpandingOccurs when a row in the hierarchical data structure is about to expand.
SortedOccurs after sorting has changed on the data source.
PropertyChangedOccurs when a property value changes. Inherited from NotifyingBase.

RowCollapsed Event

Occurs when a hierarchical row is collapsed.

public event EventHandler<Avalonia.Controls.Models.TreeDataGrid.RowEventArgs<TRow><Avalonia.Controls.Models.TreeDataGrid.HierarchicalRow<TModel><TModel>>> RowCollapsed

RowCollapsing Event

Occurs when a hierarchical row is about to collapse.

public event EventHandler<Avalonia.Controls.Models.TreeDataGrid.RowEventArgs<TRow><Avalonia.Controls.Models.TreeDataGrid.HierarchicalRow<TModel><TModel>>> RowCollapsing

RowExpanded Event

Occurs when a row in the hierarchical data structure is expanded.

public event EventHandler<Avalonia.Controls.Models.TreeDataGrid.RowEventArgs<TRow><Avalonia.Controls.Models.TreeDataGrid.HierarchicalRow<TModel><TModel>>> RowExpanded

RowExpanding Event

Occurs when a row in the hierarchical data structure is about to expand.

public event EventHandler<Avalonia.Controls.Models.TreeDataGrid.RowEventArgs<TRow><Avalonia.Controls.Models.TreeDataGrid.HierarchicalRow<TModel><TModel>>> RowExpanding

Sorted Event

Occurs after sorting has changed on the data source.

public event Action Sorted