TreeDataGridSource Class
Definition
Represents a data source for a Avalonia.Controls.TreeDataGrid control.
public class TreeDataGridSource
Methods
| Name | Description |
|---|---|
| ClearSort | Clears any sorting applied to the specified column. |
| ModelIndexToRowIndex | Converts a model index to the corresponding row index in the current view. |
| RowIndexToModelIndex | Converts a row index in the current view to the corresponding model index. |
| SortBy | Requests 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
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
| Name | Description |
|---|---|
| AllowTriStateSorting | Gets or sets a value indicating whether tri-state sorting (ascending, descending, unsorted) is allowed when clicking column headers. |
| AutoDragDropRows | Gets or sets a value indicating whether rows can be automatically dragged and dropped within the TreeDataGrid. |
| CanUserResizeColumns | Gets or sets a value indicating whether users can resize columns. |
| CanUserSortColumns | Gets or sets a value indicating whether users can sort columns by clicking column headers. |
| Columns | Gets the columns to be displayed. |
| FrozenColumnCount | Gets or sets the number of columns that are frozen at the start of the grid. |
| 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. |
| Rows | Gets the rows to be displayed. |
| Selection | Gets or sets the selection model. |
| ShowColumnHeaders | Gets 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; }
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
| Name | Description |
|---|---|
| PropertyChanged | Occurs when a property value changes. |
PropertyChanged Event
Occurs when a property value changes.
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged