Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    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
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

Note

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. 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.17.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:

Note

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?​​​​​​​