Interactive Features in UWP Spreadsheet (SfSpreadsheet)

10 May 20214 minutes to read

This section explains about the interactive operations with SfSpreadsheet

Clipboard Operations

SfSpreadsheet provides support for all the clipboard operations to with all the format settings when copied within a workbook.

You can use the following shortcut keys for Clipboard operations like Excel

Operations Shortcut Keys
Cut Ctrl + X
Copy Ctrl + C
Paste Ctrl + V

The following are a list of paste options used while performing paste operation,

Options Description
Paste To paste with all the format options in the source range
Formula To paste the formulas alone
Keep Source Formatting To maintain the source range’s formatting
Value To paste the values alone
Format To paste only the formats alone without pasting the values.
Value & Source Formatting To maintain the source range original format and paste only values


When the content is copied from external source, SfSpreadsheet does not support the format settings (paste options).

For Cut Operation,

//To perform cut operation for selected ranges
var range = spreadsheet.ActiveGrid.SelectedRanges.ActiveRange;
spreadsheet.ActiveGrid.CopyPaste.Copy(range, true);

//To perform cut operation

For Copy Operation,

//To perform copy operation for selected ranges
var range = spreadsheet.ActiveGrid.SelectedRanges.ActiveRange;
spreadsheet.ActiveGrid.CopyPaste.Copy(range, false);

//To perform Copy operation

For Paste Operation,

//To perform paste operation

//To perform paste operation with range and Paste Options
var copyPaste = spreadsheet.ActiveGrid.CopyPaste as SpreadsheetCopyPaste;
copyPaste.Paste(range, PasteOptions.Paste);


Users can also set their default PasteOptions while pasting in SfSpreadsheet, by using DefaultPasteOption Property.


SfSpreadsheet provides support for Undo/Redo functionality like Microsoft Excel.

The shortcut keys used for Undo/Redo Operations

Operations Shortcut Keys
Undo Ctrl + Z
Redo Ctrl + Y

SfSpreadsheet has History Manager class that supports the implementation of undo/ redo operations

By default, Undo/Redo operations in SfSpreadsheet is enabled. To disable the Undo/Redo operations, set the Enabled property of History Manager to be false.

spreadsheet.HistoryManager.Enabled = false;

To programmatically, invoke the Undo/Redo operations,

spreadsheet.HistoryManager.Enabled = true;

Context menu

Context menu in SfSpreadsheet is customizable menu which can be used for various functionalities

Cell Context menu

Cell Context menu opens when the user right-click on a worksheet cell or selection of cells in SfSpreadsheet.

By default, Cell Context menu is enabled in SfSpreadsheet. To disable the Cell Context menu, set the AllowCellContextMenu property as false.

spreadsheet.AllowCellContextMenu = false;

Users can also customize the Cell Context menu of SfSpreadsheet by using CellContextMenuOpening Event of SpreadsheetGrid.

Adding the customized menu items in the CellContextMenuOpening Event,

spreadsheet.ActiveGrid.CellContextMenuOpening += ActiveGrid_CellContextMenuOpening;

void ActiveGrid_CellContextMenuOpening(object sender, CellContextMenuOpeningEventArgs e)

    //Adding Customized Menu item
    MenuItem PasteSpecial = new MenuItem();
    PasteSpecial.Header = "PasteSpecial";
    Image paste = new Image() { Source = new BitmapImage(new Uri(@"..\..\Icon\paste.png", UriKind.Relative)) };
    PasteSpecial.Icon = paste;
    //Remove the existing Context menu


Custom Cell Context menu can also by added by assigning the customized menu items to the CellContextMenu property of SpreadsheetGrid. For your reference, CustomContextMenu

Cell Comments

SfSpreadsheet provides support for cell comments like in excel to give the reader additional context for the data it contains. You can set the comment height and color for the particular comments at runtime by invoking CellCommentOpening Event of SpreadsheetGrid

To enable the comment in SfSpreadsheet, set the ShowComment property of SpreadsheetGrid to true.

spreadsheet.ActiveGrid.ShowComment = true;

To set the comments for particular cell at run time,

spreadsheet.ActiveSheet.Range["E5"].AddComment().Text = "Sample Comment";
spreadsheet.ActiveGrid.InvalidateCell(5, 5);