Class GridCellRendererBase
Represents a class that provides a default implementation of the IGridCellRenderer interface for a cell renderer. You should derive from this class to implement custom cell renderer classes. There is however no dependency on GridCellRendererBase inside of the control.
If you want to implement a renderer with support for live views inside the cell you should derive from the GridVirtualizingCellRendererBase<T1, T2> or grid adapted GridVirtualizingCellRendererBase classes.
Namespace: Syncfusion.SfDataGrid.XForms
Assembly: Syncfusion.SfDataGrid.XForms.dll
Syntax
public class GridCellRendererBase : Object, IGridCellRenderer, IDisposable
Constructors
GridCellRendererBase()
Initializes a new instance of the GridCellRendererBase class.
Declaration
public GridCellRendererBase()
Properties
CurrentCellElement
Gets the view of the current cell.
Declaration
public CellElement CurrentCellElement { get; }
Property Value
Type | Description |
---|---|
CellElement | The view of the current cell. |
CurrentCellIndex
Gets the current cell's row column index.
Declaration
public RowColumnIndex CurrentCellIndex { get; }
Property Value
Type | Description |
---|---|
RowColumnIndex | The current cell's row column index. |
CurrentCellRendererElement
Gets the view of the current cell element.
Declaration
public View CurrentCellRendererElement { get; }
Property Value
Type | Description |
---|---|
Xamarin.Forms.View | The view of the current cell element. |
DataGrid
Gets or sets the reference of the SfDataGrid control.
Declaration
public SfDataGrid DataGrid { get; set; }
Property Value
Type | Description |
---|---|
SfDataGrid | The reference of the SfDataGrid control. |
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
Gets or sets a value indicating whether the cell is editable.
Declaration
public bool IsEditable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the cell is editable, otherwise false. The default value is false. |
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. |
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, CellElement, GridColumn, Object)
This method fires when editing in the current cell begins.
Declaration
public virtual bool BeginEdit(RowColumnIndex rowColumnIndex, CellElement cellElement, GridColumn column, object rowData)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowColumnIndex | The row column index of the cell which is in edit mode. |
CellElement | cellElement | The UIElement of the cell which is in edit mode. |
GridColumn | 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.SfDataGrid.XForms.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 virtual 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()
Releases all resources used by the GridCellRendererBase class.
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 | if true - release both managed and unmanaged resources; if false - release only unmanaged resources. |
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.SfDataGrid.XForms.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. |
OnLayout(RowColumnIndex, View, Int32, Int32, Int32, Int32)
Called from the parent to arrange the GridCell's children view(s).
Declaration
protected virtual void OnLayout(RowColumnIndex rowColumnIndex, View view, int left, int top, int right, int bottom)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowColumnIndex | Row Column Index of the cell. |
Xamarin.Forms.View | view | Corresponding view. |
System.Int32 | left | left end of the cell for arranging the view. |
System.Int32 | top | top value for arranging the view. |
System.Int32 | right | right end of the cell for arranging the view. |
System.Int32 | bottom | bottom value for arranging the view. |
OnMeasure(RowColumnIndex, View, Int32, Int32)
Called from the parent to Measure the GridCell's children view(s).
Declaration
protected virtual void OnMeasure(RowColumnIndex rowColumnIndex, View view, int widthMeasureSpec, int heightMeasureSpec)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowColumnIndex | Row Column Index of the cell. |
Xamarin.Forms.View | view | Corresponding view. |
System.Int32 | widthMeasureSpec | Corresponding width for measuring the view size. |
System.Int32 | heightMeasureSpec | Corresponding height for measuring the view size. |
OnPrepareViews(DataColumnBase)
Called from PrepareViews(DataColumnBase) to prepare the GridCell's children view(s). VirtualizingCellRendererBase overrides this method and creates new views and wires them with the parent cells control.
Declaration
protected virtual CellElement OnPrepareViews(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
Returns
Type | Description |
---|---|
CellElement | Returns the columnElement of the cell. |
OnRefreshDisplayValue(DataColumnBase)
Called from RefreshDisplayValue(DataColumnBase) to refresh the display value of the column element.
Declaration
protected virtual void OnRefreshDisplayValue(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
OnSetCellStyle(DataColumnBase)
Called from SetCellStyle(DataColumnBase) to set the style for the column element in a Syncfusion.SfDataGrid.XForms.DataColumn.
Declaration
protected virtual void OnSetCellStyle(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The data column. |
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.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
OnUpdateCellStyle(DataColumnBase)
Called from UpdateCellStyle(DataColumnBase) to update the cell style for the column element in a Syncfusion.SfDataGrid.XForms.DataColumn.
Declaration
protected virtual void OnUpdateCellStyle(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The data column. |
OnUpdateCellValue(DataColumnBase)
Called from UpdateCellValue(DataColumnBase) to update the cell value of the column element.
Declaration
protected virtual void OnUpdateCellValue(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn. |
OnUpdateColumnInfo(DataColumnBase)
Called from UpdateColumnInfo(DataColumnBase) to update the value of the Cell view corresponding to GridColumn. In our control we are reusing the cell views for horizontal scrolling. Hence we need to update the value of the cell view.
Declaration
protected virtual void OnUpdateColumnInfo(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
PrepareViews(DataColumnBase)
Method which is used to create and initiate the view for the cell.
Declaration
public CellElement PrepareViews(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
Returns
Type | Description |
---|---|
CellElement | Returns the view of the cell. |
RefreshDisplayValue(DataColumnBase)
Method which is used to refresh the display value of the cell.
Declaration
public void RefreshDisplayValue(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
ResetCurrentCellState()
Resets the current cell information in renderer, when the current cell is deactivated.
Declaration
public void ResetCurrentCellState()
SetCellStyle(DataColumnBase)
Method used to set the cell style.
Declaration
public void SetCellStyle(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
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, CellElement, Boolean)
Update the current cell information in the renderer while current cell was activated.
Declaration
public void SetCurrentCellState(RowColumnIndex currentCellIndex, CellElement currentCellElement, bool isInEditing)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | currentCellIndex | The row column index of the current cell. |
CellElement | currentCellElement | The UIElement of the current cell. |
System.Boolean | isInEditing | The value indicating whether the view is in edit mode 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. |
SetFocus(View, Boolean)
Sets the focus for the editing view.
Declaration
protected virtual void SetFocus(View view, bool needToFocus)
Parameters
Type | Name | Description |
---|---|---|
Xamarin.Forms.View | view | Current cell renderer element. |
System.Boolean | needToFocus | Returns whether focus has to be set or not. |
UnloadViews(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 AllowRecycle was set.
Declaration
public void UnloadViews(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
UpdateCellStyle(DataColumnBase)
Method used to update the cell style.
Declaration
public void UpdateCellStyle(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
UpdateCellValue(DataColumnBase)
Method which is used to update the cell value.
Declaration
public void UpdateCellValue(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
UpdateColumnInfo(DataColumnBase)
Method which is used to update the binding information of the cell UIElement.
Declaration
protected void UpdateColumnInfo(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |
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 |
---|---|---|
Xamarin.Forms.View | currentRendererElement | Specifies the current cell UIElement to update the current cell state. |
System.Boolean | isInEdit | Specifies whether the current cell is editable. |
Explicit Interface Implementations
IGridCellRenderer.UpdateColumnInfo(DataColumnBase)
Method which is used to update the binding information of the cell UIElement.
Declaration
void IGridCellRenderer.UpdateColumnInfo(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
Syncfusion.SfDataGrid.XForms.DataColumnBase | dataColumn | The dataColumn containing the details of the column. |