Skip to main content

TreeDataGridCellsPresenter Class

Definition

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

Presents and manages cells within a row of a Avalonia.Controls.TreeDataGrid control.

public class TreeDataGridCellsPresenter

Inheritance: TreeDataGridColumnarPresenterBase<IColumn> -> TreeDataGridCellsPresenter

Remarks

TreeDataGridCellsPresenter is responsible for creating, recycling, and arranging cells horizontally within a row of a TreeDataGrid. It handles the virtualization of cells, ensuring that only visible cells are realized in the visual tree to improve performance.

This presenter is typically used within a Avalonia.Controls.Primitives.TreeDataGridRow control template to display the cells for that row. It coordinates with its parent row and the TreeDataGrid to manage cell lifecycle, selection state, and layout.

Constructors

NameDescription
TreeDataGridCellsPresenterNo summary available.

TreeDataGridCellsPresenter Constructor

public TreeDataGridCellsPresenter()

Methods

NameDescription
GetChildIndexGets child's actual index in order of the original source.
RealizePrepares the presenter to display cells for the specified row index.
TryGetTotalCountNo summary available.
UnrealizeReleases resources used by the presenter and prepares it for reuse.
UpdateRowIndexUpdates the row index of this presenter and all its cells.

GetChildIndex Method

Gets child's actual index in order of the original source.

public int GetChildIndex(Avalonia.LogicalTree.ILogical child)

Parameters

child Avalonia.LogicalTree.ILogical

Logical child.

Returns

int

Index or -1 if child was not found.

Realize Method

Prepares the presenter to display cells for the specified row index.

public void Realize(int index)

Parameters

index int

The index of the row to realize.

Remarks

This method is called by the TreeDataGrid when a row needs to be prepared for display. It initializes the presenter with the specified row index and triggers a measure pass to create and arrange the cells.

Exceptions

TryGetTotalCount Method

public bool TryGetTotalCount(int& count)

Parameters

count int&

Returns

bool

Unrealize Method

Releases resources used by the presenter and prepares it for reuse.

public void Unrealize()

Remarks

This method is called by the TreeDataGrid when a row is no longer needed for display. It clears the presenter's row index and recycles all cell elements.

Exceptions

UpdateRowIndex Method

Updates the row index of this presenter and all its cells.

public void UpdateRowIndex(int index)

Parameters

index int

The new row index.

Remarks

This method is called when the index of the row changes, such as when rows are inserted or removed above it. It updates the presenter's row index and updates the row index of all realized cells.

Exceptions

Properties

NameDescription
FrozenColumnCountGets or sets the number of frozen columns.
RowIndexGets the index of the row that this presenter is currently displaying.
RowsGets or sets the rows collection from which to obtain cell data.

FrozenColumnCount Property

Gets or sets the number of frozen columns.

public int FrozenColumnCount { get; set; }

Remarks

Frozen columns do not scroll horizontally and remain visible at all times.

RowIndex Property

Gets the index of the row that this presenter is currently displaying.

public int RowIndex { get; set; }

Value

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

Rows Property

Gets or sets the rows collection from which to obtain cell data.

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

Value

The collection of rows used to populate cells in this presenter.

Fields

FrozenColumnCountProperty Field

Defines the Avalonia.Controls.Primitives.TreeDataGridCellsPresenter.FrozenColumnCount property.

public Avalonia.StyledProperty<int> FrozenColumnCountProperty

RowsProperty Field

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

public Avalonia.DirectProperty<Avalonia.Controls.Primitives.TreeDataGridCellsPresenter, Avalonia.Controls.Models.TreeDataGrid.IRows> RowsProperty

Events

NameDescription
ChildIndexChangedOccurs when the index of a child element in the presenter changes.

ChildIndexChanged Event

Occurs when the index of a child element in the presenter changes.

public event EventHandler<Avalonia.LogicalTree.ChildIndexChangedEventArgs> ChildIndexChanged