Skip to main content

TemplateCell Class

Definition

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

Represents a cell in a Avalonia.Controls.Models.TreeDataGrid that displays its contents using data templates.

public class TemplateCell

Inheritance: object -> TemplateCell

Implements: ICell, IEditableObject

Remarks

The Avalonia.Controls.Models.TreeDataGrid.TemplateCell class provides template-based rendering and editing capabilities for cells in a TreeDataGrid. It allows for customizable content presentation beyond simple text or checkbox cells.

This class serves as the data model that backs the Avalonia.Controls.Primitives.TreeDataGridTemplateCell primitive control. The primitive control handles UI rendering and user interactions, while this model provides access to the templates and the underlying value.

The cell can have two different visual representations: one for display mode (using Avalonia.Controls.Models.TreeDataGrid.TemplateCell.GetCellTemplate) and optionally one for editing mode (using Avalonia.Controls.Models.TreeDataGrid.TemplateCell.GetCellEditingTemplate).

Constructors

NameDescription
TemplateCellNo summary available.

TemplateCell Constructor

public TemplateCell(object value, Func<Avalonia.Controls.Control, Avalonia.Controls.Templates.IDataTemplate> getCellTemplate, Func<Avalonia.Controls.Control, Avalonia.Controls.Templates.IDataTemplate> getCellEditingTemplate, Avalonia.Controls.Models.TreeDataGrid.ITemplateCellOptions options)

Parameters

value object

getCellTemplate Func<Avalonia.Controls.Control, Avalonia.Controls.Templates.IDataTemplate>

getCellEditingTemplate Func<Avalonia.Controls.Control, Avalonia.Controls.Templates.IDataTemplate>

options Avalonia.Controls.Models.TreeDataGrid.ITemplateCellOptions

Properties

NameDescription
CanEditGets a value indicating whether the cell can enter edit mode.
EditGesturesGets the gesture(s) that will cause the cell to enter edit mode.
GetCellEditingTemplateGets a function that retrieves the data template for editing the cell value, or null if the cell is not editable.
GetCellTemplateGets a function that retrieves the data template for displaying the cell value.
ValueGets the underlying value of the cell.

CanEdit Property

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

public bool CanEdit { get; set; }

Remarks

Returns true if an editing template has been provided through Avalonia.Controls.Models.TreeDataGrid.TemplateCell.GetCellEditingTemplate; otherwise, false.

EditGestures Property

Gets the gesture(s) that will cause the cell to enter edit mode.

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

Remarks

Returns the edit gestures specified in the options, or Avalonia.Controls.Models.TreeDataGrid.BeginEditGestures.Default if no options were provided.

GetCellEditingTemplate Property

Gets a function that retrieves the data template for editing the cell value, or null if the cell is not editable.

public Func<Avalonia.Controls.Control, Avalonia.Controls.Templates.IDataTemplate> GetCellEditingTemplate { get; set; }

Remarks

This function is used by the Avalonia.Controls.Primitives.TreeDataGridTemplateCell to obtain the template to use for rendering the cell's content when in edit mode.

GetCellTemplate Property

Gets a function that retrieves the data template for displaying the cell value.

public Func<Avalonia.Controls.Control, Avalonia.Controls.Templates.IDataTemplate> GetCellTemplate { get; set; }

Remarks

This function is used by the Avalonia.Controls.Primitives.TreeDataGridTemplateCell to obtain the template to use for rendering the cell's content when not in edit mode.

Value Property

Gets the underlying value of the cell.

public object Value { get; set; }

Remarks

This is the object that will be used as the data context for the template.