HypernovaDesktop Components · docs
Binarymission
WPF › Ribbon

Ribbon

.NET Framework 4.8.NET 6 / 8 / 10v6.0.0WPF

The ribbon: a row of tabs, each holding labelled groups of commands, under the window's title, an application button and a quick access toolbar – the command surface of an Office-style application.

69public types
753public members
1namespaces

Assembly

AssemblyBinarymission.WPF.Controls.BinaryRibbon.dll
Root namespaceBinarymission.WPF.Controls.Office
Target frameworks.NET Framework 4.8, .NET 6 / 8 / 10
Depends onSkinning

Overview

Put it at the top of a BinaryRibbonWindow, which draws the caption buttons and frame around it, as the main menu and toolbar of a document or line-of-business application.

Building a ribbon

Its content is Tabs: each BinaryRibbonTabItem holds BinaryRibbonGroups, and each group holds commands – BinaryRibbonButton, BinaryRibbonSplitButtonControl, BinaryRibbonDropDownButton, BinaryRibbonComboBox, BinaryRibbonGallery and the rest. Add ApplicationMenu, QuickAccessToolBar and TitleText.

Fitting the width

As the window narrows, the groups give way a step at a time from the last: their commands shrink – a large picture over the caption, then a small picture beside it, then the picture alone, as each command allows – and at last the group folds into one button that drops its commands down. SetMinSize, SetMaxSize and SetResizableSize set a command's steps. Below 240 logical pixels the tabs and commands are hidden (IsMinimized).

Showing more or less

DisplayState shows tabs and commands, tabs only (a clicked tab drops its commands over the document) or neither; Ctrl+F1, a double-click on a tab and the right-click menu switch it. RibbonLayout picks the classic three-row or the simplified one-line ribbon, and ContextualTabSet adds tabs for what is selected – a table, a picture – under a coloured title.

Keyboard, tips and skins

BinaryKeyTip.SetAccessKey gives a command a key tip, shown level by level on Alt or F10 in a BinaryRibbonWindow; BinaryRibbonScreenTipService.SetScreenTip gives it a titled screen tip. Users add commands to the quick access toolbar by right-clicking them, and GetQuickAccessToolBarState keeps their choice for the next run. Colours come from BinaryRibbonBuiltInSkinController.Skin.

Getting started

An invoicing window with an application menu, a quick access toolbar and key tips; its code-behind class derives from BinaryRibbonWindow.

<bm:BinaryRibbonWindow x:Class="Invoicing.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:bm="clr-namespace:Binarymission.WPF.Controls.Office;assembly=Binarymission.WPF.Controls.BinaryRibbon"
    Title="Invoicing" Width="1100" Height="700">
  <DockPanel>
    <bm:BinaryRibbonBarPanel DockPanel.Dock="Top" TitleText="Invoicing - Northwind Traders">
      <bm:BinaryRibbonBarPanel.ApplicationMenu>
        <bm:BinaryRibbonApplicationMenu bm:BinaryKeyTip.AccessKey="F">
          <bm:BinaryRibbonApplicationMenuItem Header="New invoice" Image="Images/NewInvoice32.png" Click="OnNewInvoice" />
          <bm:BinaryRibbonApplicationMenuItem Header="Open..." Image="Images/Open32.png" Click="OnOpen" />
          <Separator />
          <bm:BinaryRibbonApplicationMenuItem Header="Exit" Click="OnExit" />
        </bm:BinaryRibbonApplicationMenu>
      </bm:BinaryRibbonBarPanel.ApplicationMenu>
      <bm:BinaryRibbonBarPanel.QuickAccessToolBar>
        <bm:BinaryRibbonQuickAccessToolBar>
          <bm:BinaryRibbonButton SmallImage="Images/Save16.png" ToolTip="Save" Click="OnSave" />
          <bm:BinaryRibbonButton SmallImage="Images/Undo16.png" ToolTip="Undo" Command="ApplicationCommands.Undo" />
        </bm:BinaryRibbonQuickAccessToolBar>
      </bm:BinaryRibbonBarPanel.QuickAccessToolBar>
      <bm:BinaryRibbonTabItem HeaderText="Home" bm:BinaryKeyTip.AccessKey="H">
        <bm:BinaryRibbonGroup TitleText="Invoice" CanShowModalDialog="True" ExecuteModalDialogLauncher="OnInvoiceOptions">
          <bm:BinaryRibbonButton Content="New" LargeImage="Images/NewInvoice32.png" bm:BinaryKeyTip.AccessKey="N" Click="OnNewInvoice" />
          <bm:BinaryRibbonButton Content="Send" LargeImage="Images/Send32.png" bm:BinaryKeyTip.AccessKey="S" Click="OnSendInvoice" />
        </bm:BinaryRibbonGroup>
        <bm:BinaryRibbonGroup TitleText="Clipboard">
          <bm:BinaryRibbonButton Content="Paste" LargeImage="Images/Paste32.png" Command="ApplicationCommands.Paste" />
          <bm:BinaryRibbonButton Content="Cut" SmallImage="Images/Cut16.png" bm:BinaryRibbonBarPanel.MaxSize="Medium" Command="ApplicationCommands.Cut" />
          <bm:BinaryRibbonButton Content="Copy" SmallImage="Images/Copy16.png" bm:BinaryRibbonBarPanel.MaxSize="Medium" Command="ApplicationCommands.Copy" />
        </bm:BinaryRibbonGroup>
      </bm:BinaryRibbonTabItem>
    </bm:BinaryRibbonBarPanel>
    <DataGrid ItemsSource="{Binding Invoices}" />
  </DockPanel>
</bm:BinaryRibbonWindow>

API reference

Binarymission.WPF.Controls.Office

enum ApplicationMenuButtonStyleHow the round application menu button at the top left of a BinaryRibbonWindow is drawn.
class BinaryKeyTipKey tips: the letters shown over ribbon commands when the user presses Alt, so that every command can be reached from the keyboard.
enum BrushChangeTargetPropertySays which brush ChangeColorForAccessTips sets.
class BinaryRibbonApplicationMenuThe application button at the start of the ribbon's tab row, and the menu it drops down: the file commands - New, Open, Save As, Print, Exit - on the left, and a list such as recent documents on the right.
class BinaryRibbonApplicationMenuItemA command in a BinaryRibbonApplicationMenu: a large picture and its caption, and optionally a submenu under a title of its own - Save As, Print, Share.
class BinaryRibbonBackstageApplicationMenuAn application button whose menu opens as a panel across the width of the window - a backstage view - holding whatever elements the application puts in it.
class BinaryRibbonBackstageBorderWidthConverterTakes 8 device-independent units off a bound width - the margin the backstage menu's border leaves around its content.
class BinaryRibbonBarPanelThe ribbon: a row of tabs, each holding labelled groups of commands, under the window's title, an application button and a quick access toolbar - the command surface of an Office-style application.
enum BinaryRibbonBarRenderingAlignmentWhich end of a tab's groups is in view when the groups are wider than the ribbon and it shows scroll buttons.
class BinaryRibbonBuiltInSkinControllerSwitches every ribbon in the application between the built-in looks - the Office 2007 and Windows 7 skins, ten colour skins and the Fluent skins of current Office - with one property.
class BinaryRibbonButtonThe ribbon's push button: a command with a picture and a caption that redraws itself large, medium or small as the ribbon gives it room.
enum BinaryRibbonButtonControlStyleThe kinds of ribbon button: a plain button, a drop-down button or a pop-up button.
class BinaryRibbonButtonGroupA row of small ribbon buttons joined edge to edge into one rounded strip, like Office's Bold, Italic and Underline or its paragraph alignment buttons.
class BinaryRibbonComboBoxA drop-down list for the ribbon, with an optional caption beside it and room for your own content above and below the list - a font size box, a style picker, a list of saved views.
class BinaryRibbonComboBoxItemAn entry in a ribbon drop-down list, drawn in the ribbon's style with an optional small picture to the left of its text.
class BinaryRibbonControlContextualTabSetA set of contextual tabs: extra tabs at the end of the ribbon's tab row, under a coloured title, that are on show only while the user works on one kind of thing - a picture, a table, a chart.
class BinaryRibbonControlGroupSizingOrderConverterReads a comma-separated list of names into a StringCollection, for the ribbon tab's own record of the order in which its groups give up width.
enum BinaryRibbonControlSizeHow large a ribbon command is drawn, from a large picture with a caption beneath it down to nothing at all.
class BinaryRibbonControlSizeCollectionThe sizes a ribbon command takes at each step as its group gives up width - the value of the attached ResizableSizeProperty.
class BinaryRibbonControlSizingCollectionConverterReads the XAML text of ResizableSizeProperty - "Large,Medium,Small" or "L,M,S" - into a BinaryRibbonControlSizeCollection.
enum BinaryRibbonDisplayStateHow much of the ribbon is on screen.
class BinaryRibbonDropDownButtonA ribbon button that opens a drop-down of further commands - Office's Paste Special, Insert Table or Export menus.
class BinaryRibbonFontFamilyComboBoxA ribbon drop-down that lists every font installed on the computer, ready to use as a Font box.
class BinaryRibbonGalleryA ribbon gallery: a strip of picture choices shown right on the ribbon, a row or two at a time, that opens into a full drop-down of every choice - Office's Styles, Table Styles and Themes galleries.
class BinaryRibbonGalleryControlColumnsThe column counts a BinaryRibbonGallery takes at each step as its group gives up width - the value of the attached RenderableGalleryColumnsProperty.
class BinaryRibbonGalleryControlColumnsCollectionConverterReads the XAML text of RenderableGalleryColumnsProperty - "6,4,0" - into a BinaryRibbonGalleryControlColumns.
class BinaryRibbonGroupA titled group of related commands on a ribbon tab - Clipboard, Font, Paragraph - with an optional dialog launcher in its corner, which folds into a single drop-down button when the ribbon runs out of room.
enum BinaryRibbonLayoutHow the ribbon lays its commands out beneath the tabs.
class BinaryRibbonLivePreviewThe routed events a ribbon gallery raises so that an application can show the effect of a choice in its document before the user commits to it, and the methods for handling them.
class BinaryRibbonLivePreviewEventArgsThe data for the live preview events of BinaryRibbonLivePreview: which item to preview or apply.
class BinaryRibbonMenuItemA menu entry in the ribbon's style - for the drop-downs of ribbon buttons and for the application menu - with a small picture, a tick when checked, and an arrow that opens a sub-menu.
class BinaryRibbonQuickAccessToolBarThe quick access toolbar: a short row of small commands - Save, Undo, Redo - kept on show above the ribbon's tabs, or below the ribbon, whichever tab is selected.
class BinaryRibbonScreenTipA screen tip: the titled tool tip a ribbon shows for a command - its name in bold, a sentence on what it does, an optional picture, and a footer offering help.
class BinaryRibbonScreenTipHelpRequestedEventArgsThe data for HelpRequestedEvent, raised when the user presses F1 while a screen tip is showing: which screen tip it was, and the help topic it names.
class BinaryRibbonScreenTipServiceAttaches a BinaryRibbonScreenTip to a command, with the timing and placement a ribbon command wants.
class BinaryRibbonScrollViewerThe scroll viewer the ribbon uses inside its own drop-downs, with scroll bars drawn in the colours of the ribbon's skin.
class BinaryRibbonSeparatorA thin vertical rule between commands in a ribbon group, in the colours of the ribbon's skin.
class BinaryRibbonSmartTextBoxA ribbon text box with a watermark prompt while it is empty, a button that clears it, an optional filter on what can be typed, and a small flag picture that changes when the box is left empty - for search boxes, quick filters and required fields on the ribbon.
class BinaryRibbonSplitButtonControlA ribbon button in two parts: the main part runs a default command at once, and the arrow part holds a drop-down of alternatives - Office's Paste, Undo or Insert Date buttons.
class BinaryRibbonTabItemOne tab of a BinaryRibbonBarPanel: a heading in the tab row, and the BinaryRibbonGroups of commands shown beneath it while it is selected.
class BinaryRibbonTextBoxControlA labelled text box for the ribbon: an optional small picture and a caption, then the box - Office's "Height" and "Width" boxes, or a "Find" box.
class BinaryRibbonThemeResourcesThe resource keys behind every colour, brush and template the ribbon draws with, for restyling any part of it with values of your own.
class BinaryRibbonThumbnailControlOne picture choice in a BinaryRibbonGallery - a style, a colour, a layout - drawn as a cell that highlights under the pointer and stays pressed while it is selected.
class BinaryRibbonToggleButtonControlA ribbon button that stays pressed while it is on - Bold, Show Ruler, Track Changes - drawn large, medium or small as the ribbon gives it room.
class BinaryRibbonWindowThe window a ribbon application lives in: it gives its caption to a BinaryRibbonBarPanel - title, application button and quick access toolbar - and draws caption buttons, frame and corners to match the ribbon's skin.
enum BitmapEffectKinds of visual effect.
class BooleanToRibbonGroupTitleTextPanelHeightConverterTurns whether a ribbon group shows its title into the height of the title strip: 16 units when it does, 1 when it does not.
enum DataEntryModeWhich characters a BinaryRibbonSmartTextBox lets the user type, set through its DataEntryMode property.
interface IBinaryRibbonApplicationMenuMarks a control as one that can be a ribbon's application menu - the type of ApplicationMenu. It declares no members.
interface IBinaryRibbonComponentImplemented by every ribbon command. A group sizes the commands that implement it as the ribbon narrows, and the quick access toolbar puts them on its bar rather than in its menu.
interface IBinaryRibbonComponentActAsGalleryImplemented by galleries: a group shrinks them by showing fewer columns of items rather than by making them smaller, and shows them as a drop-down button when no columns are left.
interface IBinaryRibbonComponentAlwaysRenderLargeMarks a ribbon command that breaks a run of small commands: the group does not stack the commands before it and after it together into rows of three. Galleries and flow groups implement it.
interface IBinaryRibbonComponentCanDisplayImageImplemented by ribbon controls that show a picture of their own - BinaryRibbonGroup, BinaryRibbonComboBox, BinaryRibbonComboBoxItem.
interface IBinaryRibbonComponentCanRenderInReducedSizeStateImplemented by ribbon controls that have a title of their own, kept when the ribbon shrinks them - BinaryRibbonGroup, BinaryRibbonComboBox.
interface IBinaryRibbonComponentCanStretchAndBeRotatedMarks a ribbon command that is stretched to the width of the widest command in its column, as the combo boxes are.
interface IBinaryRibbonContentElementImplemented by ribbon commands that have a caption and a large and a small picture - buttons, toggle buttons and drop-down buttons. The ribbon shows the picture that suits the size it gives the command.
interface IBinaryRibbonContentElementBoundsConfigurableImplemented by ribbon commands with a caption and pictures whose corners can be rounded - as a BinaryRibbonButtonGroup rounds the outer corners of its first and last buttons.
interface IBinaryRibbonElementBoundsConfigurableImplemented by ribbon elements whose corners can be rounded, such as BinaryRibbonButtonGroup.
interface IBinaryRibbonInformationTagContainerImplemented by ribbon elements that carry an object of the application's own.
interface IBinaryRibbonKeyTipControlImplemented by a control that does something of its own when its key tip is typed - a button clicks, a tab selects itself, a menu opens.
interface IBinaryRibbonTextBoxControlImplemented by the ribbon's text boxes: an editable box with a caption and a picture beside it, as BinaryRibbonTextBoxControl is.
class IsLessThanValueConverterReports whether a bound size is under 40 device-independent units.
class LongTextToTextBlockConverterTurns a caption into a centred two-line TextBlock, broken at the space nearest its middle - how a large ribbon button sets its caption under its picture.
enum QuickAccessToolbarChildPlacementTargetWhere a command attached to the quick access toolbar is meant to appear: on the toolbar, in its overflow menu, or in both.
enum QuickAccessToolbarPlacementLocationWhere the quick access toolbar sits: above the ribbon, in the title area, or below it.
enum RibbonSkinThe built-in looks for the ribbon and its window, chosen with Skin.
class RibbonWindowBorderHolds CornerStyle, the choice of rounded corners for a BinaryRibbonWindow.
enum CornerStyleWhich corners of a BinaryRibbonWindow are rounded, set through its WindowBorderEdgeRenderingMode property.
enum WindowTitleBarBackgroundRenderingStyleA choice of fill for the title bar of a BinaryRibbonWindow, taken by its WindowTitleBarBackgroundRenderingStyle property.