Skip to main content

TreeDataGridSource Class

Definition​

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

Represents a data source for a Avalonia.Controls.TreeDataGrid control.

public class TreeDataGridSource

Inheritance: object -> TreeDataGridSource

Implements: INotifyPropertyChanged

Methods​

NameDescription
ClearSortClears any sorting applied to the specified column.
ModelIndexToRowIndexConverts a model index to the corresponding row index in the current view.
RowIndexToModelIndexConverts a row index in the current view to the corresponding model index.
SortByRequests to sort the source by the specified column.

ClearSort Method​

Clears any sorting applied to the specified column.

public void ClearSort(Avalonia.Controls.TreeDataGridColumn column)

Parameters​

column Avalonia.Controls.TreeDataGridColumn

The column.

ModelIndexToRowIndex Method​

Converts a model index to the corresponding row index in the current view.

public int ModelIndexToRowIndex(Avalonia.Controls.IndexPath modelIndex)

Parameters​

modelIndex Avalonia.Controls.IndexPath

The model index.

Returns​

int

The corresponding row index, or -1 if the model index is not currently displayed (for example because it is collapsed or filtered out).

Remarks​

A model index identifies an item by its position in the source data, whereas a row index identifies a row by its position in the flattened, sorted and filtered view.

RowIndexToModelIndex Method​

Converts a row index in the current view to the corresponding model index.

public Avalonia.Controls.IndexPath RowIndexToModelIndex(int rowIndex)

Parameters​

rowIndex int

The row index.

Returns​

Avalonia.Controls.IndexPath

The corresponding model index, or an empty path if the row index is not valid.

Remarks​

A row index identifies a row by its position in the flattened, sorted and filtered view, whereas a model index identifies an item by its position in the source data.

SortBy Method​

Requests to sort the source by the specified column.

public bool SortBy(Avalonia.Controls.TreeDataGridColumn column, System.ComponentModel.ListSortDirection direction)

Parameters​

column Avalonia.Controls.TreeDataGridColumn

The column.

direction System.ComponentModel.ListSortDirection

The sort direction.

Returns​

bool

True if the sort could be performed; otherwise false.

Properties​

NameDescription
AllowTriStateSortingGets or sets a value indicating whether tri-state sorting (ascending, descending, unsorted) is allowed when clicking column headers.
AutoDragDropRowsGets or sets a value indicating whether rows can be automatically dragged and dropped within the TreeDataGrid.
CanUserReorderColumnsGets or sets a value indicating whether users can reorder columns by dragging column headers.
CanUserResizeColumnsGets or sets a value indicating whether users can resize columns.
CanUserSortColumnsGets or sets a value indicating whether users can sort columns by clicking column headers.
ColumnsGets the columns to be displayed.
FrozenColumnCountGets or sets the number of columns that are frozen at the start of the grid.
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.
RowsGets the rows to be displayed.
SelectionGets or sets the selection model.
ShowColumnHeadersGets or sets a value indicating whether column headers are shown.

AllowTriStateSorting Property​

Gets or sets a value indicating whether tri-state sorting (ascending, descending, unsorted) is allowed when clicking column headers.

public bool AllowTriStateSorting { get; set; }

AutoDragDropRows Property​

Gets or sets a value indicating whether rows can be automatically dragged and dropped within the TreeDataGrid.

public bool AutoDragDropRows { get; set; }

CanUserReorderColumns Property​

Gets or sets a value indicating whether users can reorder columns by dragging column headers.

public bool CanUserReorderColumns { get; set; }

CanUserResizeColumns Property​

Gets or sets a value indicating whether users can resize columns.

public bool CanUserResizeColumns { get; set; }

CanUserSortColumns Property​

Gets or sets a value indicating whether users can sort columns by clicking column headers.

public bool CanUserSortColumns { get; set; }

Columns Property​

Gets the columns to be displayed.

public Avalonia.Controls.TreeDataGridColumns Columns { get; set; }

FrozenColumnCount Property​

Gets or sets the number of columns that are frozen at the start of the grid.

public int FrozenColumnCount { 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<object> Items { get; set; }

Rows Property​

Gets the rows to be displayed.

public Avalonia.Controls.TreeDataGridRows Rows { get; set; }

Selection Property​

Gets or sets the selection model.

public Avalonia.Controls.Selection.TreeDataGridSelectionModel 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.

ShowColumnHeaders Property​

Gets or sets a value indicating whether column headers are shown.

public bool ShowColumnHeaders { get; set; }

Events​

NameDescription
PropertyChangedOccurs when a property value changes.

PropertyChanged Event​

Occurs when a property value changes.

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged