Class SpreadsheetCellRendererBase
Represents the base cell renderer for cell types used in SfSpreadsheet.
If you want to implement a renderer with support for live UIElements inside the cell you should derive from the SpreadsheetCellRendererBase or grid adapted SpreadsheetVirtualizingCellRendererBase classes.
Inheritance
Namespace: Syncfusion.UI.Xaml.Spreadsheet.CellRenderer
Assembly: Syncfusion.SfSpreadsheet.UWP.dll
Syntax
public class SpreadsheetCellRendererBase : Object, ISpreadsheetCellRenderer, IDisposable
Constructors
SpreadsheetCellRendererBase()
Initializes a new instance of the SpreadsheetCellRendererBase class.
Declaration
public SpreadsheetCellRendererBase()
Properties
AllowEditInFormulaBar
Gets or sets the value indicating whether the user is allowed to edit the cell using formula bar or not
Declaration
public bool AllowEditInFormulaBar { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the cell can be edited using formula bar; otherwise false |
CurrentCellElement
Gets a value indicating the current cell(GridCell) UIElement in SfSpreadsheet
Declaration
public UIElement CurrentCellElement { get; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.UIElement | An instance of |
CurrentCellIndex
Gets a value indicating the current cell's coordinates.
Declaration
public RowColumnIndex CurrentCellIndex { get; }
Property Value
Type | Description |
---|---|
RowColumnIndex | An instance of RowColumnIndex |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the CurrentCellIndex is accessed before the current cell is maintained. |
CurrentCellRendererElement
Gets a value indicating edit UIElement of current cell. It should be null when current cell is not in editing.
Declaration
public UIElement CurrentCellRendererElement { get; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.UIElement | An instance of |
CurrentStyle
Gets a value indicating the style information for the current cell in SfSpreadsheet.
Declaration
public IStyle CurrentStyle { get; }
Property Value
Type | Description |
---|---|
IStyle | An instance of IStyle. |
DisplayElementOptimization
Gets or sets a value indicating whether to load the UIElement to display its content or not.
Declaration
public bool DisplayElementOptimization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if it loads the display Element for the cell only when the content is not empty; otherwise, false. |
Remarks
If true, it will loads the display element for the cell only when it have content. It the cell is empty, then it doesn’t load the display element.
Grid
Gets or sets the value indicating the instance of SfCellGrid
Declaration
public SpreadsheetGrid Grid { get; set; }
Property Value
Type | Description |
---|---|
SpreadsheetGrid | An instance of SfCellGrid |
HasCurrentCellState
Gets a value indicating whether the current cell renderer is set or not.
Declaration
public bool HasCurrentCellState { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Returns true if the current cell state is maintained; otherwise , false. |
IsEditable
Gets or sets a value indicating whether the user can perform editing on this cell type.
Declaration
public bool IsEditable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user able to perform edit operation ; otherwise, false. |
IsFocused
Gets or sets a value indicating whether the focus is set on the current cell in SfSpreadsheet .
Declaration
public bool IsFocused { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the focus is set on current cell ; otherwise, false. |
IsFocusible
Gets or sets a value indicating whether the user is able to focus the UIElement or not .
Declaration
public bool IsFocusible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can able to focus the element ; otherwise, false. |
IsInEditing
Gets or sets a value indicating whether the current cell is in editing or not.
Declaration
public bool IsInEditing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the user can perform the editing in the current cell; otherwise, false. |
MoveCurrentCell
Gets or sets a value whether the current cell can be moved by pressing the arrow keys while editing.
Declaration
protected bool MoveCurrentCell { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True or False |
Remarks
Set as true, when current cell is first time edit the text or directly edit the text if that cell is not in edit mode whether cell is empty or not empty. And also if true, then only move the current cell when up or down key is pressed otherwise not move. Otherwise set as false.
PreviewInputText
Gets or sets a value indicating the input text for the renderer .
Declaration
protected object PreviewInputText { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The text for the renderer |
SupportDrawingOptimization
Gets or sets a value whether the cell content should be drawn or not.
Declaration
public bool SupportDrawingOptimization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true draw its content; else loads display element to display its content. |
SupportRenderOptimization
Gets or sets a value indicates whether the edit element directly loads to display the content even the cell is not in edit mode.
Declaration
public bool SupportRenderOptimization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the renderer supports directly to the drawing context ; otherwise, false. |
UseOnlyRendererElement
Gets or sets a value indicates whether to use the cell element (GridCell) to display its content.
Declaration
public bool UseOnlyRendererElement { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the grid cell is placed inside the renderer element; otherwise, false. |
Methods
Arrange(RowColumnIndex, UIElement, Rect)
Invoked when the visual children of cell is arranged in view.
Declaration
public void Arrange(RowColumnIndex cellRowColumnIndex, UIElement uiElement, Rect cellRect)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | The Coordinates of the cell. |
Windows.UI.Xaml.UIElement | uiElement | The corresponding UIElement that is to be arranged |
Windows.Foundation.Rect | cellRect | The corresponding size of cell element for arranging the UIElement |
BeginEdit(RowColumnIndex, GridCell, SpreadsheetColumn)
Invoked when the current cell in the view starts the editing process.
Declaration
public virtual bool BeginEdit(RowColumnIndex CellRowColumnIndex, GridCell cellContainer, SpreadsheetColumn column)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | CellRowColumnIndex | Coordinates of a cell. |
GridCell | cellContainer | An instance of GridCell. |
SpreadsheetColumn | column | An instance of SpreadsheetColumn. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the current cell starts an editing; otherwise, false. |
CharacterReceived(CharacterReceivedEventArgs)
Declaration
public void CharacterReceived(CharacterReceivedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Core.CharacterReceivedEventArgs | args |
ClearRecycleBin()
Clears all the items from RecycleBin.
Declaration
public virtual void ClearRecycleBin()
CurrentCellValueChanged(String)
Invoked when the current cell value is changed in SfSpreadsheet.
Declaration
protected virtual void CurrentCellValueChanged(string ChangedText)
Parameters
Type | Name | Description |
---|---|---|
System.String | ChangedText | Text to be changed. |
Remarks
It also updates the floating cell with current text size.
Dispose()
Call the Dispose and SuppressFinalize method for dipose the instance of GridCell class.
Declaration
public void Dispose()
Dispose(Boolean)
Releases all resources used by the SpreadsheetCellRendererBase.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Dispose the instance, if it is True |
Remarks
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
EndEdit(RowColumnIndex, GridCell, SpreadsheetColumn)
Ends the editing operation occuring in the cell.
Declaration
public virtual bool EndEdit(RowColumnIndex cellRowColumnIndex, GridCell cellContainer, SpreadsheetColumn column)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Cooridantes of a cell. |
GridCell | cellContainer | An instance of GridCell. |
SpreadsheetColumn | column | An instance of SpreadsheetColumn. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the edit ends on the cell ; otherwise, false. |
GetControlValue()
Used to get the control value for the current cell.
Declaration
public virtual object GetControlValue()
Returns
Type | Description |
---|---|
System.Object | null. |
GetFormattedText(IStyle)
Used to get the formatted text for the particular cell.
Declaration
public virtual string GetFormattedText(IStyle style)
Parameters
Type | Name | Description |
---|---|---|
IStyle | style | An instance of IStyle. |
Returns
Type | Description |
---|---|
System.String | An empty string |
Measure(RowColumnIndex, UIElement, Size)
Determines the size of the current cell in SfSpreadsheet
Declaration
public void Measure(RowColumnIndex cellRowColumnIndex, UIElement uiElement, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Coordinates of a cell |
Windows.UI.Xaml.UIElement | uiElement | Corresponing UI element to measure |
Windows.Foundation.Size | availableSize | The size of element |
OnArrange(RowColumnIndex, UIElement, Rect)
Invoked when the visual children of cell is arranged in view.
Declaration
protected virtual void OnArrange(RowColumnIndex cellRowColumnIndex, UIElement uiElement, Rect cellRect)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | The Coordinates of the cell. |
Windows.UI.Xaml.UIElement | uiElement | The corresponding UIElement that is to be arranged |
Windows.Foundation.Rect | cellRect | The corresponding size of cell element for arranging the UIElement |
OnCharacterReceived(CharacterReceivedEventArgs)
Declaration
protected virtual void OnCharacterReceived(CharacterReceivedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Core.CharacterReceivedEventArgs | args |
OnMeasure(RowColumnIndex, UIElement, Size)
Determines the size of the current cell in SfSpreadsheet.
Declaration
protected virtual void OnMeasure(RowColumnIndex cellRowColumnIndex, UIElement uiElement, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Coordinates of a cell. |
Windows.UI.Xaml.UIElement | uiElement | Corresponing UI element to measure . |
Windows.Foundation.Size | availableSize | The size of element. |
OnPrepareUIElements(RowColumnIndex, GridCell, SpreadsheetColumn, Boolean)
Invoked when the UIElement for cell is prepared to render it in view .
Declaration
protected virtual GridCell OnPrepareUIElements(RowColumnIndex cellRowColumnIndex, GridCell cellContainer, SpreadsheetColumn column, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Coordinates of a cell. |
GridCell | cellContainer | An instance of GridCell. |
SpreadsheetColumn | column | An instance of SpreadsheetColumn. |
System.Boolean | isInEdit | True or False. |
Returns
Type | Description |
---|---|
GridCell | An instance of GridCell. |
OnSaveChanges()
Updates the changes of current cell in SfSpreadsheet.
Declaration
protected virtual void OnSaveChanges()
OnUnloadUIElements(GridCell)
Invoked when the cell is scrolled out of view or unloaded from the view. SpreadsheetVirtualizingCellRendererBase<D, E> overrides this method and either removes the cell renderer visuals from the parent or hide them and reuse it later in same element depending on whether AllowRecycle was set.
Declaration
protected virtual void OnUnloadUIElements(GridCell uiElement)
Parameters
Type | Name | Description |
---|---|---|
GridCell | uiElement | An instance of GridCell. |
PrepareUIElements(RowColumnIndex, GridCell, SpreadsheetColumn, Boolean)
Invoked when the UIElement for cell is prepared to render it in view .
Declaration
public GridCell PrepareUIElements(RowColumnIndex cellRowColumnIndex, GridCell cellContainer, SpreadsheetColumn column, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Coordinates of a cell |
GridCell | cellContainer | An instance of GridCell |
SpreadsheetColumn | column | An instance of SpreadsheetColumn |
System.Boolean | isInEdit | True or False |
Returns
Type | Description |
---|---|
GridCell | An instance of GridCell |
RaiseSaveChanges()
Invoked to save the current cell changes in SfSpreadsheet.
Declaration
public void RaiseSaveChanges()
RefreshContent()
Refreshes the content of the current cell in SfSpreadsheet.
Declaration
public virtual void RefreshContent()
ResetCurrentCellState()
Resets or updates the current cell state and style.
Declaration
public void ResetCurrentCellState()
SetControlValue(Object)
Used to set the value for the current cell.
Declaration
public virtual bool SetControlValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | Current cell's value. |
Returns
Type |
---|
System.Boolean |
SetCurrentCellState(RowColumnIndex, UIElement, Boolean, Boolean)
Set the current cell state when the current cell is active.
Declaration
public void SetCurrentCellState(RowColumnIndex currentCellIndex, UIElement currentCellElement, bool isInEditing, bool isFocused)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | currentCellIndex | Coordinates of a current cell. |
Windows.UI.Xaml.UIElement | currentCellElement | An instance of System.Windows.UIElement. |
System.Boolean | isInEditing | True or False . |
System.Boolean | isFocused | True or False . |
SetFocus(Boolean)
Used to invoke the Focus method to set the focus on the given UIElement.
Declaration
public void SetFocus(bool needToFocus)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | needToFocus | True or False . |
SetFocus(UIElement, Boolean)
Invoked to set the focus to the UIElement.
Declaration
protected virtual void SetFocus(UIElement uiElement, bool needToFocus)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.UIElement | uiElement | An instance of System.Windows. |
System.Boolean | needToFocus | trueif keyboard focus and logical focus were set to this element; false if only logical focus was set to this element, or if the call to this method did not force the focus to change. |
ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs)
Handles all the key down operations for the current cell in SfSpreadsheet.
Declaration
protected virtual bool ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.KeyRoutedEventArgs | e | An System.Windows.Input.KeyEventArgs that contains the event data. |
Returns
Type | Description |
---|---|
System.Boolean | True or False. |
UnloadUIElements(GridCell)
Invoked when the cell is scrolled out of view or unloaded from the view. SpreadsheetVirtualizingCellRendererBase<D, E> overrides this method and either removes the cell renderer visuals from the parent or hide them and reuse it later in same element depending on whether AllowRecycle was set.
Declaration
public void UnloadUIElements(GridCell uiElement)
Parameters
Type | Name | Description |
---|---|---|
GridCell | uiElement | An instance of GridCell |
UpdateCellStyle(RowColumnIndex, GridCell, SpreadsheetColumn, Boolean)
Updates the style for the current cell in SfSpreadsheet.
Declaration
public virtual void UpdateCellStyle(RowColumnIndex cellRowColumnIndex, GridCell uiElement, SpreadsheetColumn column, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Coordinates of cell. |
GridCell | uiElement | An instance of GridCell. |
SpreadsheetColumn | column | An instance of SpreadsheetColumn. |
System.Boolean | isInEdit | True or False. |
UpdateCurrentCellState(UIElement, Boolean)
Updates the current cell state for the specified current cell renderer element.
Declaration
protected void UpdateCurrentCellState(UIElement currentRendererElement, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.UIElement | currentRendererElement | Current cell renderer element. |
System.Boolean | isInEdit | True or False |
Explicit Interface Implementations
ISpreadsheetCellRenderer.ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs)
Declaration
bool ISpreadsheetCellRenderer.ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.KeyRoutedEventArgs | e |
Returns
Type |
---|
System.Boolean |