[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
    Product Structure
   [Collapse]Getting Started
     Lesson 1 - Create a Simple Spreadsheet
     Lesson 2 - Create Separate Ribbon Pages for the Spreadsheet
     Lesson 3 - Create an Application using the Instant Layout Assistant (for VS 2015 and earlier)
     Lesson 4 - Customize the Integrated Ribbon UI for the Spreadsheet
     Lesson 5 - Customize the Spreadsheet Status Bar
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charts and Graphics
    Operation Restrictions
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Themes and Templates
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Lesson 2 - Create Separate Ribbon Pages for the Spreadsheet

This document describes how you can add a ribbon UI to the WPF Spreadsheet to provide end-users with a familiar Office-inspired interface with rich spreadsheet functionality.


The mechanism of ribbon generation described in this document is outdated and retained for backward compatibility. The newly created WPF Spreadsheet application already contains the integrated ribbon with all available ribbon pages and a formula bar in v17.1 and higher. This makes the XAML markup compact and more readable. You can customize the integrated ribbon user interface by adding new ribbon elements, modifying or removing the existing ones. Refer to the Lesson 4 - Customize the Integrated Ribbon UI for the Spreadsheet topic for example.

This tutorial consists of the following sections:

Expanded Create a Spreadsheet Application

  1. Create a new WPF Application project and open the MainWindow.xaml file in the Visual Studio Designer.
  2. Add the SpreadsheetControl object to your project. You can do this by dragging the SpreadsheetControl item from the DX.19.2: Spreadsheet Toolbox tab to the canvas.

  3. Right-click the SpreadsheetControl object and select Layout | Reset All in the context menu to stretch the SpreadsheetControl so that it fills the entire window.
  4. Click the SpreadsheetControl's smart tag. In the invoked menu, under Integrated Ribbon and Formula Bar, select Empty from the CommandBarStyle drop-down list to disable the integrated ribbon UI.

Expanded Create Ribbon Pages

  1. To create separate ribbon pages, click the SpreadsheetControl's smart tag, and in the invoked menu, under Create Separate Ribbon Pages, select the ribbon pages you wish to add to your application or click All to display all available spreadsheet ribbon pages at once.

  2. Convert the Window to ThemedWindow. To do this, click the Window's smart tag and select the Convert to ThemedWindow task.

  3. Change the Ribbon Style by clicking the RibbonControl's smart tag and setting the RibbonStyle property to Office 2010.

Expanded View the Result

Run the project. The following image illustrates the result:


Commands executed via the Bar (Ribbon) user interface can throw unhandled exceptions if a problem occurs. Consider the situation when a document is being saved to a locked or read-only file. To prevent application failure, subscribe to the SpreadsheetControl.UnhandledException event and set the SpreadsheetUnhandledExceptionEventArgs.Handled property to true.

Is this topic helpful?​​​​​​​