Class GridCellToggleSwitchRenderer
Represents a class that maintains the rendering of GridToggleSwitchColumn.
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.DataGrid.Renderers
Assembly: Syncfusion.Grid.WinUI.dll
Syntax
public class GridCellToggleSwitchRenderer : GridVirtualizingCellRenderer<ToggleSwitch, ToggleSwitch>, IGridCellRenderer, IDisposable
Examples
this.sfDataGrid.CellRenderers.Remove("ToggleSwitch");
this.sfDataGrid.CellRenderers.Add("ToggleSwitch", new GridCellToggleSwitchRendererExt());
public class GridCellToggleSwitchRendererExt : GridCellToggleSwitchRenderer
{
public override void OnInitializeEditElement(DataColumnBase dataColumn, ToggleSwitch uiElement, object dataContext)
{
base.OnInitializeEditElement(dataColumn, uiElement, dataContext);
uiElement.IsEnabled = false;
}
}
Constructors
GridCellToggleSwitchRenderer()
Initializes a new instance of the GridCellToggleSwitchRenderer class.
Declaration
public GridCellToggleSwitchRenderer()
Methods
CanCheckAddNewRowAtFirstClick()
Method that is used to decide whether AddNewRowControl ToggleSwitchColumn can get toggle at first click or not.
Declaration
protected virtual bool CanCheckAddNewRowAtFirstClick()
Returns
Type | Description |
---|---|
System.Boolean | True, if AddNewRowControl ToggleSwitchColumn can toggle at first click; otherwise false. |
CanUpdateBinding(GridColumn)
Determines whether the binding for the column can be updated when the data context is set.
Declaration
public override bool CanUpdateBinding(GridColumn column)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the binding is updated for the column; otherwise false. |
Overrides
EndEdit(DataColumnBase, Object, Boolean)
Ends the edit occurring on the cell.
Declaration
public override bool EndEdit(DataColumnBase dc, object record, bool canResetBinding = false)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dc | DataColumn which holds GridColumn, RowColumnIndex and GridCell |
System.Object | record | The corresponding record to complete the edit operation. |
System.Boolean | canResetBinding | Specifies whether the binding is reset or not. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the editing is completed; 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 as |
Overrides
OnEditElementLoaded(Object, RoutedEventArgs)
Invoked when the edit element(ToggleSwitch) 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(ToggleSwitch) 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
OnInitializeEditElement(DataColumnBase, ToggleSwitch, Object)
Called when initialize the edit element.
Declaration
public override void OnInitializeEditElement(DataColumnBase dataColumn, ToggleSwitch uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | DataColumn Which holds GridColumn, RowColumnIndex and GridCell |
Microsoft.UI.Xaml.Controls.ToggleSwitch | uiElement | Corresponding Renderer Element |
System.Object | dataContext | The data context. |
Overrides
OnUnwireEditUIElement(ToggleSwitch)
Unwires the events associated with edit UIElement.
Declaration
protected override void OnUnwireEditUIElement(ToggleSwitch uiElement)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Controls.ToggleSwitch | uiElement | The corresponding edit UIElement to unwire its events. |
Overrides
OnUpdateEditBinding(DataColumnBase, ToggleSwitch, Object)
Called when [update edit binding].
Declaration
public override void OnUpdateEditBinding(DataColumnBase dataColumn, ToggleSwitch element, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | DataColumn which holds GridColumn, RowColumnIndex and GridCell |
Microsoft.UI.Xaml.Controls.ToggleSwitch | element | The element. |
System.Object | dataContext | The data context. |
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
SetFocus(FrameworkElement, Boolean)
Sets the focus to the specified current cell uielement.
Declaration
protected override void SetFocus(FrameworkElement uiElement, bool needToFocus)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.FrameworkElement | uiElement | Specifies the corresponding current cell uielement. |
System.Boolean | needToFocus | Decides whether the focus set to current cell uielement. |
Overrides
ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs)
Let Renderer decide whether the parent grid should be allowed to handle keys and prevent the key event from being handled by the visual UIElement for this renderer. If this method returns true the parent grid will handle arrow keys and set the Handled flag in the event data. Keys that the grid does not handle will be ignored and be routed to the UIElement for this renderer.
Declaration
protected override bool ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.KeyRoutedEventArgs | e | A Microsoft.UI.Xaml.Input.KeyRoutedEventArgs object. |
Returns
Type | Description |
---|---|
System.Boolean | True if the parent grid should be allowed to handle keys; false otherwise. |