SpreadsheetGrid Class
Represents a class which is used for displaying the data of IWorksheet.
Inheritance
Namespace: Syncfusion.UI.Xaml.Spreadsheet
Assembly: Syncfusion.SfSpreadsheet.UWP.dll
Syntax
public class SpreadsheetGrid : SfCellGrid
Remarks
The data will be displayed in the form of rows and columns. This class also includes the selection and editing operations in grid that allow the users to easily manage the data.
Constructors
SpreadsheetGrid()
Initializes a new instance of the SpreadsheetGrid class.
Declaration
public SpreadsheetGrid()
Properties
CellRenderers
Gets a value indicating the instance of SpreadsheetCellRendererCollection which holds the collection of cellrenderer objects.
Declaration
public SpreadsheetCellRendererCollection CellRenderers { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetCellRendererCollection | An instance of SpreadsheetCellRendererCollection. |
CurrentCell
Gets the value indicating the instance of the SpreadsheetCurrentCell which maintains the current cell in SpreadsheetGrid.
Declaration
public SpreadsheetCurrentCell CurrentCell { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetCurrentCell | An instance of SpreadsheetCurrentCell. |
FillSeriesController
Gets or sets the value indicating the instance of FillSeriesController which provides support to autofill the data.
Declaration
public FillSeriesController FillSeriesController { get; set; }
Property Value
| Type | Description |
|---|---|
| FillSeriesController | An instance of FillSeriesController. |
GraphicModel
Gets the value indicating the instance of GraphicModel which holds all the information about graphic cells.
Declaration
public GraphicModel GraphicModel { get; }
Property Value
| Type | Description |
|---|---|
| GraphicModel | An instance of GraphicModel. |
Model
Gets the value indicating the instance of SpreadsheetGridModel which holds the operation on rows and columns in SpreadsheetGrid.
Declaration
public SpreadsheetGridModel Model { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetGridModel | An instance of SpreadsheetGridModel |
SheetName
Gets the value indicating the name of the worksheet in the Workbook.
Declaration
public string SheetName { get; }
Property Value
| Type | Description |
|---|---|
| System.String | Name of the worksheet. |
Worksheet
Gets the value indicating the instance of IWorksheet in the Workbook.
Declaration
public IWorksheet Worksheet { get; }
Property Value
| Type | Description |
|---|---|
| IWorksheet | An instance of IWorksheet. |
Methods
add_QueryRange(SpreadsheetQueryRangeEventHandler)
Declaration
public void add_QueryRange(SpreadsheetQueryRangeEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetQueryRangeEventHandler | value |
Dispose(Boolean)
Releases all resources used by the. SpreadsheetGrid.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
GetCalculatedValue(IRange)
Returns the calculated value (without formatting) for a formula cell.
Declaration
public string GetCalculatedValue(IRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | range | IRange. |
Returns
| Type |
|---|
| System.String |
Remarks
If the passed range is not a formula cell, then it returns null.
GetCellValue(Int32, Int32)
Used to get the value of the cell.
Declaration
public override object GetCellValue(int rowIndex, int colIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | RowIndex of the cell. |
| System.Int32 | colIndex | ColumnIndex of the cell. |
Returns
| Type | Description |
|---|---|
| System.Object | Returns the cell value. |
GetDependentCellValue(Int32, Int32)
This method gets the dependent cell value of the corresponding row and column index of the SpreadsheetGrid.
Declaration
public override string GetDependentCellValue(int rowIndex, int colIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | Index of the corresponding cell's row. |
| System.Int32 | colIndex | Index of the corresponding cell's column. |
Returns
| Type | Description |
|---|---|
| System.String | An instance of IRange. |
GetDisplayText(Int32, Int32)
Used to get the display text of the cell.
Declaration
public override string GetDisplayText(int rowIndex, int colIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | RowIndex of the cell. |
| System.Int32 | colIndex | ColumnIndex of the cell. |
Returns
| Type | Description |
|---|---|
| System.String | Returns the display text. |
InitializeCellRendererCollection()
Initializes the CellRenderer Collection in the SpreadsheetGrid.
Declaration
protected override void InitializeCellRendererCollection()
OnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call System.Windows.FrameworkElement.ApplyTemplate.
Declaration
protected override void OnApplyTemplate()
Remarks
Builds a visual tree for the VisualContainerExt, when a new template is applied and initialize the Grouping elements and cellrenderer collection.
OnCellRequestNavigateEvent(CellRequestNavigateEventArgs)
Provides support for hyperlink navigation between different cells in SpreadsheetGrid.
Declaration
protected override bool OnCellRequestNavigateEvent(CellRequestNavigateEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.UI.Xaml.CellGrid.Helpers.CellRequestNavigateEventArgs | e | An instance of Syncfusion.UI.Xaml.CellGrid.Helpers.CellRequestNavigateEventArgs |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if the navigation can be done in cell; otherwise, false. |
OnContainerKeyDown(KeyRoutedEventArgs)
Declaration
protected override bool OnContainerKeyDown(KeyRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.KeyRoutedEventArgs | e |
Returns
| Type |
|---|
| System.Boolean |
OnCoreWindowCharacterReceived(CoreWindow, CharacterReceivedEventArgs)
Declaration
protected override void OnCoreWindowCharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Core.CoreWindow | sender | |
| Windows.UI.Core.CharacterReceivedEventArgs | args |
OnCreateCopyPaste()
Initialize the SpreadsheetCopyPaste when the SpreadsheetGrid is loaded.
Declaration
protected override GridCopyPaste OnCreateCopyPaste()
Returns
| Type | Description |
|---|---|
| Syncfusion.UI.Xaml.CellGrid.GridCopyPaste | An instance of SpreadsheetCopyPaste. |
OnCreateCurrentCell()
Creates a new instance of the Syncfusion.UI.Xaml.CellGrid.GridCurrentCell which maintains the current cell in the grid.
Declaration
protected override GridCurrentCell OnCreateCurrentCell()
Returns
| Type | Description |
|---|---|
| Syncfusion.UI.Xaml.CellGrid.GridCurrentCell | An instance of SpreadsheetColumn. |
OnCreateGridColumn(SfCellGrid)
Creates a new instance of the Syncfusion.UI.Xaml.CellGrid.GridColumn which holds the information of the every cells in the grid.
Declaration
protected override GridColumn OnCreateGridColumn(SfCellGrid grid)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.UI.Xaml.CellGrid.SfCellGrid | grid | An instance of Syncfusion.UI.Xaml.CellGrid.SfCellGrid. |
Returns
| Type | Description |
|---|---|
| Syncfusion.UI.Xaml.CellGrid.GridColumn | An instance of SpreadsheetColumn. |
OnCreateModel()
Creates a new instance of the SpreadsheetGridModel for the grid.
Declaration
protected override GridModel OnCreateModel()
Returns
| Type | Description |
|---|---|
| Syncfusion.UI.Xaml.CellGrid.GridModel | null. |
OnCurrentCellEndEdit(CurrentCellEndEditEventArgs)
Commits and ends the edit operation on the current cell in SfSpreadsheet.
Declaration
protected override void OnCurrentCellEndEdit(CurrentCellEndEditEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.UI.Xaml.CellGrid.Helpers.CurrentCellEndEditEventArgs | e | An Syncfusion.UI.Xaml.CellGrid.Helpers.CurrentCellEndEditEventArgs that contains the event data. |
OnKeyDown(KeyRoutedEventArgs)
Occurs before the KeyDown event when a key is pressed while focus is on this control.
Declaration
protected override void OnKeyDown(KeyRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.KeyRoutedEventArgs | e | An System.Windows.Input.KeyEventArgs that contains the event data. |
OnKeyUp(KeyRoutedEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.KeyUp attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnKeyUp(KeyRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.KeyRoutedEventArgs | e | The System.Windows.Input.KeyEventArgs that contains the event data. |
OnVisualContainerPointerMoved(Object, PointerRoutedEventArgs)
Occurs when the pointer moved over the VisualContainer.
Declaration
protected override void OnVisualContainerPointerMoved(object sender, PointerRoutedEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The source of the event. |
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | args | An System.Windows.Input.MouseEventArgs that contains the event data. |
OnVisualContainerPointerPressed(Object, PointerRoutedEventArgs)
Occurs when the pointer is pressed on VisualContainer.
Declaration
protected override void OnVisualContainerPointerPressed(object sender, PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | The source of the event. |
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | An System.Windows.Input.MouseButtonEventArgs that contains the event data. |
OnVisualContainerPointerReleased(Object, PointerRoutedEventArgs)
Declaration
protected override void OnVisualContainerPointerReleased(object sender, PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | |
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e |
remove_QueryRange(SpreadsheetQueryRangeEventHandler)
Declaration
public void remove_QueryRange(SpreadsheetQueryRangeEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetQueryRangeEventHandler | value |
SetCellValue(IRange, String)
Sets the value or formula to the given IRange in the Workbook
Declaration
public void SetCellValue(IRange currentExcelRange, string cellValue)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | currentExcelRange | An instance of IRange |
| System.String | cellValue | Value to be displayed |
SetColumnWidth(Int32, Int32, Double)
Used to set the column width in the SpreadsheetGrid.
Declaration
public override void SetColumnWidth(int startIndex, int endIndex, double width)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | startIndex | Start column index. |
| System.Int32 | endIndex | End column index. |
| System.Double | width | Width of the column to expand. |
SetRowHeight(Int32, Int32, Double)
Used to set the row height in the SpreadsheetGrid.
Declaration
public override void SetRowHeight(int startIndex, int endIndex, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | startIndex | Start row's index. |
| System.Int32 | endIndex | End row's index. |
| System.Double | height | Height of the row to resize. |
ShowHidePopup(Boolean)
To show and hide popup's when moved to another application
Declaration
public override void ShowHidePopup(bool show)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | show | True, if the popup is displayed; otherwise false |
UnWireEvents()
Unwires or unloads the events in SpreadsheetGrid.
Declaration
protected override void UnWireEvents()
WireEvents()
Wires or loads the events in SpreadsheetGrid.
Declaration
protected override void WireEvents()
Events
QueryRange
Occurs when grid queries for IRange information about a specifc cell while rendering.
Declaration
public event SpreadsheetQueryRangeEventHandler QueryRange
Event Type
| Type |
|---|
| SpreadsheetQueryRangeEventHandler |
Examples
var grid = spreadsheet.ActiveGrid;
grid.QueryRange+=grid_QueryRange;
void grid_QueryRange(object sender, SpreadsheetQueryRangeEventArgs e)
{
if (e.Cell.ColumnIndex == 5)
e.ExcelStyle.ColorIndex = ExcelKnownColors.Blue;
}