Skip to main content

Create Separate Ribbon Pages for the Spreadsheet

  • 2 minutes to read

This topic describes how to add an Excel-inspired ribbon UI to the WPF Spreadsheet.

Created Separate Ribbon Pages

Note

The ribbon generation mechanism described in this topic is outdated and retained for backward compatibility. The WPF Spreadsheet ships with an integrated ribbon in v17.1 and higher. This makes the XAML markup compact and more readable. See the following help topics for more information on the integrated ribbon:

Create a Spreadsheet Application

Create a new WPF Application project and open the MainWindow.xaml file in the Visual Studio designer.

Add the SpreadsheetControl object to your project. Drag the SpreadsheetControl item from the DX.24.2: Spreadsheet Toolbox tab onto the canvas.

Drag the Spreadsheet Control from the Toolbox

Reset the Spreadsheet control’s layout to fill the entire window. Right-click the control and select Layout | Reset All in the context menu.

Create Ribbon Pages

Invoke the SpreadsheetControl’s Quick Actions menu to create individual ribbon pages. Under Create Separate Command Bars, select the ribbon page you wish to add to your application and click Create Ribbon Items. Select All to create all available spreadsheet ribbon pages.

You can also display the integrated Formula Bar and Status Bar. In the invoked SpreadsheetControl’s Quick Actions menu, under Integrated Ribbon and Formula Bar, enable the ShowFormulaBar and ShowStatusBar checkboxes.

Create All Ribbon Pages

Click the Window’s Quick Actions and select the Convert to ThemedWindow task to convert the Window to a ThemedWindow.

Convert to Themed Window

To change the Ribbon Style, click the RibbonControl’s Quick Actions and select Office2019 from the RibbonStyle drop-down list.

Change the Ribbon Style

Note

When you execute ribbon commands, these commands can throw unhandled exceptions (for example, when you attempt to save a document to a read-only or locked file). To prevent application failure, handle the SpreadsheetControl.UnhandledException event and set the SpreadsheetUnhandledExceptionEventArgs.Handled property to true.