HierarchicalTreeDataGridSource<TModel> Class
Definition
A data source for a Avalonia.Controls.TreeDataGrid which displays a hierarchial tree where each row may have multiple columns.
public class HierarchicalTreeDataGridSource<TModel>
Constructors
| Name | Description |
|---|---|
| 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
| Name | Description |
|---|---|
| ClearSort | Clears any sorting applied to the specified column. |
| Collapse | Collapses the row at the specified index. |
| CollapseAll | Collapses all rows. |
| Dispose | No summary available. |
| Expand | Expands the row at the specified index. |
| ExpandAll | Expands all rows. |
| ExpandCollapseRecursive (2 overloads) | No summary available. |
| Filter | No summary available. |
| RefreshFilter | Refreshes the current filter applied to the collection. |
| Sort | No summary available. |
| SortBy | Requests to sort the source by the specified column. |
| TryGetModelAt | No 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
| Name | Description |
|---|---|
| CellSelection | Gets the cell selection model if cell selection is being used. |
| Columns | Gets the columns to be displayed. |
| IsFiltered | Gets a value indicating whether the data source is filtered. |
| IsHierarchical | Gets a value indicating whether the data source is hierarchical. |
| IsSorted | Gets a value indicating whether the data source is currently sorted. |
| Items | Gets the items in the data source. |
| RowSelection | Gets the row selection model if row selection is being used. |
| Rows | Gets the rows to be displayed. |
| Selection | Gets 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
| Name | Description |
|---|---|
| RowCollapsed | Occurs when a hierarchical row is collapsed. |
| RowCollapsing | Occurs when a hierarchical row is about to collapse. |
| RowExpanded | Occurs when a row in the hierarchical data structure is expanded. |
| RowExpanding | Occurs when a row in the hierarchical data structure is about to expand. |
| Sorted | Occurs after sorting has changed on the data source. |
| PropertyChanged | Occurs 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