Skip to main content

TreeDataGridRow Class

Definition

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

A control which displays a row in a Avalonia.Controls.TreeDataGrid control.

public class TreeDataGridRow

Inheritance: TemplatedControl -> TreeDataGridRow

Remarks

TreeDataGridRow is responsible for displaying a single row of data in a TreeDataGrid. It hosts a Avalonia.Controls.Primitives.TreeDataGridCellsPresenter that displays the individual cells for each column.

This class handles row selection, provides access to the row's cells, and supports drag and drop operations when Avalonia.Controls.TreeDataGrid.AutoDragDropRows is enabled.

This class implements the following pseudo-classes:

  • :selected - Set when the row is selected

Constructors

NameDescription
TreeDataGridRowInitializes a new instance of the TreeDataGridRow class.

TreeDataGridRow Constructor

Initializes a new instance of the TreeDataGridRow class.

public TreeDataGridRow()

Methods

NameDescription
TryGetCellAttempts to retrieve a realized cell at the specified column index.

TryGetCell Method

Attempts to retrieve a realized cell at the specified column index.

public Avalonia.Controls.Control TryGetCell(int columnIndex)

Parameters

columnIndex int

The index of the column.

Returns

Avalonia.Controls.Control

The cell at the specified column index, or null if no cell exists at that position.

Remarks

This method delegates to the Avalonia.Controls.Primitives.TreeDataGridRow.CellsPresenter to retrieve the cell. If the specified cell is not currently realized (e.g., scrolled out of view), this method will return null.

Properties

NameDescription
CellsPresenterGets the cells presenter that displays the cells in this row.
ColumnsGets the columns collection from the owning Avalonia.Controls.TreeDataGrid.
ElementFactoryGets or sets the element factory used to create cells.
IsSelectedGets a value indicating whether the row is selected.
ModelGets the data model associated with this row.
RowIndexGets the index of this row in the TreeDataGrid.
RowsGets the rows collection from the owning Avalonia.Controls.TreeDataGrid.

CellsPresenter Property

Gets the cells presenter that displays the cells in this row.

public Avalonia.Controls.Primitives.TreeDataGridCellsPresenter CellsPresenter { get; set; }

Remarks

The cells presenter is defined in the control template and is looked up in Avalonia.Controls.Primitives.TreeDataGridRow.OnApplyTemplate(Avalonia.Controls.Primitives.TemplateAppliedEventArgs).

Columns Property

Gets the columns collection from the owning Avalonia.Controls.TreeDataGrid.

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

ElementFactory Property

Gets or sets the element factory used to create cells.

public Avalonia.Controls.Primitives.TreeDataGridElementFactory ElementFactory { get; set; }

IsSelected Property

Gets a value indicating whether the row is selected.

public bool IsSelected { get; set; }

Model Property

Gets the data model associated with this row.

public object Model { get; set; }

Remarks

When the row is realized, returns the underlying model of the row. Will be of the type TModel as specified in the Avalonia.Controls.TreeDataGridSource<T>.

RowIndex Property

Gets the index of this row in the TreeDataGrid.

public int RowIndex { get; set; }

Value

The zero-based row index, or -1 if the row is not realized.

Remarks

The row index is based upon the data currently displayed in the TreeDataGrid, and not the underlying data source. For example, if the data is sorted, filtered or contains expanded hierarchical rows, the indices may not correspond directly to the data source.

Rows Property

Gets the rows collection from the owning Avalonia.Controls.TreeDataGrid.

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

Fields

ColumnsProperty Field

Defines the Avalonia.Controls.Primitives.TreeDataGridRow.Columns property.

public Avalonia.DirectProperty<Avalonia.Controls.Primitives.TreeDataGridRow, Avalonia.Controls.TreeDataGridColumns> ColumnsProperty

ElementFactoryProperty Field

Defines the Avalonia.Controls.Primitives.TreeDataGridRow.ElementFactory property.

public Avalonia.DirectProperty<Avalonia.Controls.Primitives.TreeDataGridRow, Avalonia.Controls.Primitives.TreeDataGridElementFactory> ElementFactoryProperty

IsSelectedProperty Field

Defines the Avalonia.Controls.Primitives.TreeDataGridRow.IsSelected property.

public Avalonia.DirectProperty<Avalonia.Controls.Primitives.TreeDataGridRow, bool> IsSelectedProperty

RowsProperty Field

Defines the Avalonia.Controls.Primitives.TreeDataGridRow.Rows property.

public Avalonia.DirectProperty<Avalonia.Controls.Primitives.TreeDataGridRow, Avalonia.Controls.TreeDataGridRows> RowsProperty