Class GridUnboundCellRenderer
Represents the class that used for drawing the GridUnboundColumn cells.
Inheritance
Inherited Members
Namespace: Syncfusion.WinForms.DataGrid.Renderers
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class GridUnboundCellRenderer : GridTextBoxCellRenderer, IGridCellRenderer<TableControl>, IDisposable
Examples
The following example shows how to replace the custom cell renderer.
// Remove the existing unbound cell renderer and add the custom cell renderer.
sfDataGrid1.CellRenderers.Remove("Unbound");
sfDataGrid1.CellRenderers.Add("Unbound", new CustomUnboundCellRenderer());
// Implementation for custom unbound cell render.
public class CustomUnboundCellRenderer : GridUnboundCellRenderer
{
protected override void OnEditingComplete(DataColumnBase dataColumn, TextBox currentRendererElement)
{
base.OnEditingComplete(dataColumn, currentRendererElement);
}
protected override void OnInitializeEditElement(DataColumnBase column, RowColumnIndex rowColumnIndex, TextBox uiElement)
{
base.OnInitializeEditElement(column, rowColumnIndex, uiElement);
uiElement.BackColor = Color.Green;
}
}
Constructors
GridUnboundCellRenderer()
Declaration
public GridUnboundCellRenderer()
Methods
GetEditorUIElementBounds()
Overriden to get the proper editor element bounds.
Declaration
protected override Rectangle GetEditorUIElementBounds()
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | Returns the editor element bounds. |
Overrides
OnEditingComplete(DataColumnBase, TextBox)
When complete edit, we need to raise query again to provide entered value to customer.
Declaration
protected override void OnEditingComplete(DataColumnBase dataColumn, TextBox currentRendererElement)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | DataColumn which holds GridColumn, RowColumnIndex and GridCell |
System.Windows.Forms.TextBox | currentRendererElement | The UIElement that resides in GridUnboundCell |
Overrides
OnInitializeEditElement(DataColumnBase, RowColumnIndex, TextBox)
Overriden to initialize the text box as editor control of the cell.
Declaration
protected override void OnInitializeEditElement(DataColumnBase column, RowColumnIndex rowColumnIndex, TextBox uiElement)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | column | The DataColumnBase of the current cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the current cell. |
System.Windows.Forms.TextBox | uiElement | The text box of the current cell. |
Overrides
OnRender(Graphics, Rectangle, String, CellStyleInfo, DataColumnBase, RowColumnIndex)
Overridden to draw the unbound column cell.
Declaration
protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | paint | The System.Drawing.Graphics that used to draw the cell. |
System.Drawing.Rectangle | cellRect | The bounds of the cell. |
System.String | cellValue | The value of the cell. |
CellStyleInfo | style | The CellStyleInfo of the cell. |
DataColumnBase | column | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |