Class GridCellTextBoxRenderer
Represents a class that maintains the rendering of GridTextColumn.
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.DataGrid.Renderers
Assembly: Syncfusion.Grid.WinUI.dll
Syntax
public class GridCellTextBoxRenderer : GridVirtualizingCellRenderer<TextBlock, TextBox>, IGridCellRenderer, IDisposable
Examples
this.sfDataGrid.CellRenderers.Remove("TextBox");
this.sfDataGrid.CellRenderers.Add("TextBox", new GridCellTextBoxRendererExt());
public class GridCellTextBoxRendererExt : GridCellTextBoxRenderer
{
public override void OnInitializeDisplayElement(DataColumnBase dataColumn, TextBlock uiElement, object dataContext)
{
base.OnInitializeDisplayElement(dataColumn, uiElement, dataContext);
if (dataColumn.GridColumn.MappingName.Equals("CustomerID"))
uiElement.Foreground = new SolidColorBrush(Colors.Blue);
}
public override void OnUpdateDisplayBinding(DataColumnBase dataColumn, TextBlock uiElement, object dataContext)
{
base.OnUpdateDisplayBinding(dataColumn, uiElement, dataContext);
if (dataColumn.GridColumn.MappingName.Equals("CustomerID"))
uiElement.Foreground = new SolidColorBrush(Colors.Blue);
}
}
Constructors
GridCellTextBoxRenderer()
Declaration
public GridCellTextBoxRenderer()
Methods
EndEdit(DataColumnBase, Object, Boolean)
Ends the edit occuring on the cell.
Declaration
public override bool EndEdit(DataColumnBase dc, object record, bool canResetBinding = false)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dc | Specifies the corresponding DataColumnBase. |
System.Object | record | Specifies the corresponding record. |
System.Boolean | canResetBinding | Indicates whether binding can be reset or not. |
Returns
Type | Description |
---|---|
System.Boolean | True if the edit ends on the cell; otherwise false. |
Overrides
GetControlValue()
Gets the control value of the cell.
Declaration
public override object GetControlValue()
Returns
Type | Description |
---|---|
System.Object | Returns the control value of the cell. |
Overrides
OnEditElementLoaded(Object, RoutedEventArgs)
Invoked when the edit element(TextBox) is loaded on the cell in column.
Declaration
protected override void OnEditElementLoaded(object sender, RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender. |
Microsoft.UI.Xaml.RoutedEventArgs | e | The Microsoft.UI.Xaml.RoutedEventArgs instance containing the event data. |
Overrides
OnEditElementUnloaded(Object, RoutedEventArgs)
Invoked when the edit element(TextBox) is unloaded on the cell in column.
Declaration
protected override void OnEditElementUnloaded(object sender, RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender. |
Microsoft.UI.Xaml.RoutedEventArgs | e | The Microsoft.UI.Xaml.RoutedEventArgs instance containing the event data. |
Overrides
OnInitializeDisplayElement(DataColumnBase, TextBlock, Object)
Method which initialize the display element of the column.
Declaration
public override void OnInitializeDisplayElement(DataColumnBase dataColumn, TextBlock uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the DataColumnBase. |
Microsoft.UI.Xaml.Controls.TextBlock | uiElement | Specifies the corresponding renderer element |
System.Object | dataContext | Specifies the data context of the cell. |
Overrides
OnInitializeEditElement(DataColumnBase, TextBox, Object)
Method which is used to initialize the renderer element bindings with corresponding column values.
Declaration
public override void OnInitializeEditElement(DataColumnBase dataColumn, TextBox uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase. |
Microsoft.UI.Xaml.Controls.TextBox | uiElement | Specifies the corresponding renderer element. |
System.Object | dataContext | Specifies the data context of the cell. |
Overrides
OnPreviewTextInput(KeyRoutedEventArgs)
Raises the PreviewTextInput(KeyRoutedEventArgs) event.
Declaration
protected override void OnPreviewTextInput(KeyRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.KeyRoutedEventArgs | e | The Microsoft.UI.Xaml.Input.KeyRoutedEventArgs instance containing the event data. |
Overrides
OnUnwireEditUIElement(TextBox)
Called when unwire edit unique identifier element.
Declaration
protected override void OnUnwireEditUIElement(TextBox uiElement)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Controls.TextBox | uiElement | The unique identifier element. |
Overrides
SetControlValue(Object)
Sets the control value of the cell.
Declaration
public override void SetControlValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | Specifies the value to set the control value of the cell. |
Overrides
ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs)
Handles the key interaction with editor of corresponding column.
Declaration
protected override bool ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.KeyRoutedEventArgs | e | The Microsoft.UI.Xaml.Input.KeyRoutedEventArgs instance containing the event data. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the parent grid should be allowed to handle keys; otherwise false. |