Skip to main content

ExpanderCell<TModel> Class

Definition

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

Represents a cell in a hierarchical Avalonia.Controls.Models.TreeDataGrid that can expand or collapse to reveal nested data.

public class ExpanderCell<TModel>

Inheritance: object -> NotifyingBase -> ExpanderCell<TModel>

Implements: ICell, IExpander, IExpanderCell, IDisposable

Remarks

The Avalonia.Controls.Models.TreeDataGrid.ExpanderCell<T> class wraps another cell (typically a Avalonia.Controls.Models.TreeDataGrid.TextCell<T>) and adds expansion functionality to display hierarchical data in a tree structure. It manages the expanded/collapsed state of a row and the visibility of the expander button.

This class serves as the data model that backs the Avalonia.Controls.Primitives.TreeDataGridExpanderCell primitive control. The primitive control handles UI rendering and user interactions, while this model manages the underlying expansion state and coordinates with its parent row.

Constructors

NameDescription
ExpanderCell<TModel>No summary available.

ExpanderCell<TModel> Constructor

public ExpanderCell<TModel>(Avalonia.Controls.Models.TreeDataGrid.ICell inner, Avalonia.Controls.Models.TreeDataGrid.IExpanderRow<TModel><TModel> row, IObservable<bool> showExpander, Avalonia.Experimental.Data.Core.TypedBindingExpression<TIn,TOut><TModel, bool> isExpanded)

Parameters

inner Avalonia.Controls.Models.TreeDataGrid.ICell

row Avalonia.Controls.Models.TreeDataGrid.IExpanderRow<TModel><TModel>

showExpander IObservable<bool>

isExpanded Avalonia.Experimental.Data.Core.TypedBindingExpression<TIn,TOut><TModel, bool>

Methods

NameDescription
DisposeReleases resources used by the Avalonia.Controls.Models.TreeDataGrid.ExpanderCell<T>.

Dispose Method

Releases resources used by the Avalonia.Controls.Models.TreeDataGrid.ExpanderCell<T>.

public void Dispose()

Remarks

Unsubscribes from events and disposes subscriptions to prevent memory leaks.

Properties

NameDescription
CanEditGets a value indicating whether the cell can enter edit mode.
ContentGets the inner cell that provides the content for this expander cell.
EditGesturesGets the gestures that cause the inner cell to enter edit mode.
IsExpandedGets or sets a value indicating whether the row is expanded to show child rows.
RowGets the row that this cell belongs to.
ShowExpanderGets a value indicating whether the expander button should be shown.
ValueGets the value of the cell.

CanEdit Property

Gets a value indicating whether the cell can enter edit mode.

public bool CanEdit { get; set; }

Remarks

This property delegates to the inner cell's Avalonia.Controls.Models.TreeDataGrid.ICell.CanEdit property.

Content Property

Gets the inner cell that provides the content for this expander cell.

public Avalonia.Controls.Models.TreeDataGrid.ICell Content { get; set; }

Remarks

The inner cell is wrapped by this expander cell and provides the actual content display (such as text or a checkbox).

EditGestures Property

Gets the gestures that cause the inner cell to enter edit mode.

public Avalonia.Controls.Models.TreeDataGrid.BeginEditGestures EditGestures { get; set; }

Remarks

This property delegates to the inner cell's Avalonia.Controls.Models.TreeDataGrid.ICell.EditGestures property.

IsExpanded Property

Gets or sets a value indicating whether the row is expanded to show child rows.

public bool IsExpanded { get; set; }

Remarks

When set, this property updates the expansion state of both the cell and its associated row. Setting it to true expands the row to show its children, while setting it to false collapses the row to hide its children.

This property delegates to the row's Avalonia.Controls.Models.TreeDataGrid.IExpander.IsExpanded property.

Row Property

Gets the row that this cell belongs to.

public Avalonia.Controls.Models.TreeDataGrid.IExpanderRow<TModel><TModel> Row { get; set; }

Remarks

The row provides context about the position of this cell in the hierarchical structure and manages the expansion state at the row level.

ShowExpander Property

Gets a value indicating whether the expander button should be shown.

public bool ShowExpander { get; set; }

Remarks

When true, the cell displays an expander button that can be clicked to expand or collapse the row. When false, no expander is shown, indicating that the row has no children to display. This property delegates to the row's Avalonia.Controls.Models.TreeDataGrid.IExpander.ShowExpander property.

Value Property

Gets the value of the cell.

public object Value { get; set; }

Remarks

This property delegates to the inner cell's Avalonia.Controls.Models.TreeDataGrid.ICell.Value property.

Events

NameDescription
PropertyChangedOccurs when a property value changes. Inherited from NotifyingBase.