Class DataGridCellRenderer<T1, T2>
A abstract base class for cell renderer classes that need live views displayed in a cell. You can derive from this class and provide the type of the UIElement you want to show inside cells as type parameter. The class provides strong typed virtual methods for initializing Content of the cell and arranging the cell visuals. See DataGridCellRenderer<T1, T2> for more details.
The idea behind this class is to provide a place where we can add general code that should be shared for all cell renderer classes in the tree derived from GridVirtualizingCellRendererBase. While this class does at the moment not add meaningful functionality to DataGridCellRenderer we created this extra layer of inheritance to make it easy to share code for the DataGridCellRenderer base class between grid and common assemblies and keep grid control specific code out of the base class. It is currently not possible with C# to the base class as template type parameter.
Inheritance
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public abstract class DataGridCellRenderer<T1, T2> : Object, IDataGridCellRenderer, IDisposable where T1 : View where T2 : View
Type Parameters
Name |
---|
T1 |
T2 |
Constructors
DataGridCellRenderer()
Declaration
protected DataGridCellRenderer()
Properties
CurrentCellElement
Gets the view of the current cell.
Declaration
public DataGridCell CurrentCellElement { get; }
Property Value
Type | Description |
---|---|
DataGridCell | The view of the current cell. |
CurrentCellIndex
Gets the index of the current cell.
Declaration
public RowColumnIndex CurrentCellIndex { get; set; }
Property Value
Type |
---|
RowColumnIndex |
CurrentCellRendererElement
Gets the view of the current cell element.
Declaration
public View CurrentCellRendererElement { get; }
Property Value
Type |
---|
Microsoft.Maui.Controls.View |
DataGrid
Gets the SfDataGrid
Declaration
public SfDataGrid DataGrid { get; set; }
Property Value
Type |
---|
SfDataGrid |
HasCurrentCellState
Gets a value indicating whether the cell state for the current cell has been set.
Declaration
public bool HasCurrentCellState { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the cell state for the current cell is set, otherwise false. |
IsEditable
ToDo
Declaration
public bool IsEditable { get; set; }
Property Value
Type |
---|
System.Boolean |
IsFocusable
Gets or sets a value indicating whether the grid cell is focusable.
Declaration
public bool IsFocusable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the current cell is focusable, otherwise false. The default value is true. |
IsInEditing
Gets or sets a value indicating whether the current cell is in editing.
Declaration
public bool IsInEditing { get; set; }
Property Value
Type |
---|
System.Boolean |
SupportsRenderOptimization
Gets or sets a value indicating whether the renderer supports rendering itself directly to the drawing context. When this is possible the UIElement will only be created when the user moves the mouse over the cell or if the UIElement is needed for other reasons, e.g. animate after change. The benefit of rendering directly to the DrawingContext instead of creating the UIElement is a much improved scrolling performance.
Declaration
public bool SupportsRenderOptimization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the renderer supports optimization, otherwise false. The default value is true. |
Methods
BeginEdit(RowColumnIndex, DataGridCell, DataGridColumn, Object)
This method fires when editing in the current cell begins.
Declaration
public virtual bool BeginEdit(RowColumnIndex rowColumnIndex, DataGridCell cellElement, DataGridColumn column, object rowData)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowColumnIndex | The row column index of the cell which is in edit mode. |
DataGridCell | cellElement | The UIElement of the cell which is in edit mode. |
DataGridColumn | column | The corresponding grid column of the cell which is in edit mode. |
System.Object | rowData | The corresponding record of the row which is in edit mode. |
Returns
Type | Description |
---|---|
System.Boolean | Returns a value indicating whether the cell enters into the editing mode or not. |
CanUpdateBinding(DataColumnBase)
Determines whether the binding for the column can be updated. Implement this method to update binding on particular renderer when the data context is set.
Declaration
public virtual bool CanUpdateBinding(DataColumnBase dataColumnBase)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumnBase | The corresponding column for which the binding update should be determined. |
Returns
Type | Description |
---|---|
System.Boolean | True if the binding is updated for the column, otherwise false. |
ClearRecycleBin()
Clears the recycle bin. The cell element will be stored for recycling purpose, when the cell element is scrolled out of view. This method clears all the cell elements which are stored for recycling purpose.
Declaration
public void ClearRecycleBin()
CommitCellValue(Boolean)
Commits the edited value to the underlying data.
Declaration
public virtual void CommitCellValue(bool isNewValue)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isNewValue | A value indicating whether the edited value is new value. |
Dispose()
Disposes the cell renderer and its elements.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged resources used by the component and optionally releases the managed resources
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
EndEdit(DataColumnBase, Object, Boolean)
This method fires when the editing in the current cell is ended.
Declaration
public virtual bool EndEdit(DataColumnBase dataColumn, object record, bool canResetBinding = false)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | The corresponding data column of the cell, which leaves the edit mode. |
System.Object | record | The underlying data of the cell, which leaves the edit mode. |
System.Boolean | canResetBinding | The value indicating whether to reset the binding or not. |
Returns
Type | Description |
---|---|
System.Boolean | A boolean value indicating whether the current cell has focus. |
GetControlValue()
Returns the current cell value, only if the renderer's HasCurrentCellState is true.
Declaration
public virtual object GetControlValue()
Returns
Type | Description |
---|---|
System.Object | The current cell value. |
OnCreateDisplayUIView()
Creates the view for the display UI.
Declaration
protected virtual T1 OnCreateDisplayUIView()
Returns
Type |
---|
T1 |
OnCreateEditUIView()
Creates a new view for the edit mode of cell.
Declaration
protected virtual T2 OnCreateEditUIView()
Returns
Type | Description |
---|---|
T2 | Returns the new view for edit mode of cell. |
OnEnteredEditMode(DataColumnBase, View)
Invoked when the cell is being entered on the edit mode.
Declaration
protected virtual void OnEnteredEditMode(DataColumnBase dataColumn, View currentRendererElement)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | The corresponding data column being entered on the edit mode. |
Microsoft.Maui.Controls.View | currentRendererElement | The corresponding renderer element in edit mode. |
OnInitializeDisplayView(DataColumnBase, T1)
Initializes settings of the display view.
Declaration
protected virtual void OnInitializeDisplayView(DataColumnBase dataColumn, T1 view)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | |
T1 | view |
OnInitializeEditView(DataColumnBase, T2)
Initializes the edit column element of a Syncfusion.Maui.DataGrid.DataColumn object with the given view and required values.
Declaration
public virtual void OnInitializeEditView(DataColumnBase dataColumn, T2 view)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | The data column containing the details of the column. |
T2 | view | The child view to be hosted inside the column element. |
OnPrepareViews(DataColumnBase)
Prepares the view for the display for the reusing while virtualization.
Declaration
protected virtual DataGridCell OnPrepareViews(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
Returns
Type |
---|
DataGridCell |
OnSetCellStyle(DataColumnBase)
Called when the cell style is set.
Declaration
protected virtual void OnSetCellStyle(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
OnUnloadViews(DataColumnBase)
Called from UnloadViews(DataColumnBase) after a cell is scrolled out of view. VirtualizingCellRendererBase overrides this method and either removes the cell renderer visuals from the parent canvas or hide them and reuse it later in same canvas depending on whether GridVirtualizingCellRendererBase.AllowRecycle was set.
Declaration
protected virtual void OnUnloadViews(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | The DataColumn containing the details of the column. |
OnUpdateCellValue(DataColumnBase)
Called when the cell value is updated.
Declaration
protected virtual void OnUpdateCellValue(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
PrepareViews(DataColumnBase)
ToDo
Declaration
public DataGridCell PrepareViews(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
Returns
Type |
---|
DataGridCell |
RefreshDisplayValue(DataColumnBase)
ToDo
Declaration
public void RefreshDisplayValue(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
ResetCurrentCellState()
Resets the current cell information in renderer, when the current cell is deactivated.
Declaration
public void ResetCurrentCellState()
ResumeBinding(DataColumnBase, T1)
Resumes the binding value.
Declaration
protected virtual void ResumeBinding(DataColumnBase dataColumn, T1 view)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | DataColumnBase instance. |
T1 | view | current view. |
SetCellStyle(DataColumnBase)
Called when set the cell style
Declaration
public void SetCellStyle(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
SetControlValue(Object)
Set the current cell value, only if the renderer's HasCurrentCellState is true.
Declaration
public virtual void SetControlValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to be set to the current cell. |
SetCurrentCellState(RowColumnIndex, DataGridCell, Boolean)
Update the current cell information in the renderer while current cell was activated.
Declaration
public void SetCurrentCellState(RowColumnIndex currentCellIndex, DataGridCell currentCellElement, bool isInEditing)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | currentCellIndex | The row column index of the current cell. |
DataGridCell | currentCellElement | The UIElement of the current cell. |
System.Boolean | isInEditing | The value indicating whether the view is in edit mode or not. |
SetFocus(View, Boolean)
Sets the focus for the editing view.
Declaration
protected virtual void SetFocus(View view, bool needToFocus)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Controls.View | view | Current cell renderer element. |
System.Boolean | needToFocus | Returns whether focus has to be set or not. |
SetFocus(Boolean)
Sets the focus to the current cell renderer element.
Declaration
public void SetFocus(bool setFocus)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | setFocus | The value indicating whether the current cell renderer element is focusable or not. |
SuspendBinding(DataColumnBase, T1)
Suspends the binding value.
Declaration
protected virtual void SuspendBinding(DataColumnBase dataColumn, T1 view)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | DataColumnBase instance. |
T1 | view | current view. |
UnloadViews(DataColumnBase)
ToDo
Declaration
public void UnloadViews(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
UnwireEditUIElement(T2)
Unwire the edit element to the view.
Declaration
protected virtual void UnwireEditUIElement(T2 editElement)
Parameters
Type | Name | Description |
---|---|---|
T2 | editElement | The edit element . |
UpdateCellValue(DataColumnBase)
ToDo
Declaration
public void UpdateCellValue(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
UpdateColumnInfo(DataColumnBase)
ToDo
Declaration
public void UpdateColumnInfo(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn |
UpdateCurrentCellState(View, Boolean)
Updates the current cell state for the specified current cell renderer element.
Declaration
protected void UpdateCurrentCellState(View currentRendererElement, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Controls.View | currentRendererElement | Specifies the current cell UIElement to update the current cell state. |
System.Boolean | isInEdit | Specifies whether the current cell is editable. |
UpdateEditViewCellStyle(DataColumnBase, T2)
ToDo
Declaration
protected virtual void UpdateEditViewCellStyle(DataColumnBase dataColumn, T2 editView)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.Maui.DataGrid.DataColumnBase | dataColumn | |
T2 | editView |
WireEditUIElement(T2)
Wires the edit element to the view.
Declaration
protected virtual void WireEditUIElement(T2 editElement)
Parameters
Type | Name | Description |
---|---|---|
T2 | editElement | The edit element. |