TemplateCell Class
Definition
Represents a cell in a Avalonia.Controls.Models.TreeDataGrid that displays its contents using data templates.
public class TemplateCell
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
| Name | Description |
|---|---|
| TemplateCell | No 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
| Name | Description |
|---|---|
| CanEdit | Gets a value indicating whether the cell can enter edit mode. |
| EditGestures | Gets the gesture(s) that will cause the cell to enter edit mode. |
| GetCellEditingTemplate | Gets a function that retrieves the data template for editing the cell value, or null if the cell is not editable. |
| GetCellTemplate | Gets a function that retrieves the data template for displaying the cell value. |
| Value | Gets 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.