Ribbon Class

Definition

Represents the root element of a ribbon user interface that hosts a Quick Access Toolbar, Application Menu, and tabs.

[System.Windows.StyleTypedProperty(Property="ContextualTabGroupStyle", StyleTargetType=typeof(System.Windows.Controls.Ribbon.RibbonContextualTabGroup))]
[System.Windows.StyleTypedProperty(Property="TabHeaderStyle", StyleTargetType=typeof(System.Windows.Controls.Ribbon.RibbonTabHeader))]
[System.Windows.TemplatePart(Name="PART_ContextualTabGroupItemsControl", Type=typeof(System.Windows.Controls.Ribbon.RibbonContextualTabGroupItemsControl))]
[System.Windows.TemplatePart(Name="PART_TitlePanel", Type=typeof(System.Windows.Controls.Ribbon.Primitives.RibbonTitlePanel))]
[System.Windows.TemplatePart(Name="PART_TitleHost", Type=typeof(System.Windows.Controls.ContentPresenter))]
[System.Windows.TemplatePart(Name="QatTopHost", Type=typeof(System.Windows.Controls.Grid))]
[System.Windows.TemplatePart(Name="PART_HelpPane", Type=typeof(System.Windows.Controls.ContentPresenter))]
[System.Windows.TemplatePart(Name="PART_ITEMSPRESENTERPOPUP", Type=typeof(System.Windows.Controls.Primitives.Popup))]
public class Ribbon : System.Windows.Controls.Primitives.Selector
Inheritance
Attributes

Inherited Members

System.Object

System.Windows.Controls.Control

System.Windows.Controls.ItemsControl

System.Windows.Controls.Primitives.Selector

System.Windows.DependencyObject

System.Windows.FrameworkElement

System.Windows.Media.Visual

System.Windows.Threading.DispatcherObject

System.Windows.UIElement

Examples

The following example shows a simple ribbon that is created by the Visual Studio 2010 template, with help pane and Quick Access Toolbar elements added.

<ribbon:RibbonWindow x:Class="WpfRibbonApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        Title="MainWindow"
        x:Name="RibbonWindow"
        Width="640" Height="480">

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <ribbon:Ribbon x:Name="Ribbon" Title="Ribbon Title">
            <ribbon:Ribbon.HelpPaneContent>
                <ribbon:RibbonButton SmallImageSource="Images/SmallIcon.png" />
            </ribbon:Ribbon.HelpPaneContent>
            <ribbon:Ribbon.QuickAccessToolBar>
                <ribbon:RibbonQuickAccessToolBar >
                    <ribbon:RibbonButton x:Name="QATButton1" 
                                         SmallImageSource="Images/SmallIcon.png" />
                    <ribbon:RibbonButton x:Name="QATButton2" 
                                         SmallImageSource="Images/SmallIcon.png" />
                </ribbon:RibbonQuickAccessToolBar>
            </ribbon:Ribbon.QuickAccessToolBar>
            <ribbon:Ribbon.ApplicationMenu>
                <ribbon:RibbonApplicationMenu SmallImageSource="Images\SmallIcon.png">
                    <ribbon:RibbonApplicationMenuItem Header="Hello _Ribbon"
                                                      x:Name="MenuItem1"
                                                      ImageSource="Images\LargeIcon.png"/>
                </ribbon:RibbonApplicationMenu>
            </ribbon:Ribbon.ApplicationMenu>
            <ribbon:RibbonTab x:Name="HomeTab" 
                              Header="Home">
                <ribbon:RibbonGroup x:Name="Group1" 
                                    Header="Group1">
                    <ribbon:RibbonButton x:Name="Button1"
                                         LargeImageSource="Images\LargeIcon.png"
                                         Label="Button1" />
                    <ribbon:RibbonButton x:Name="Button2"
                                         SmallImageSource="Images\SmallIcon.png"
                                         Label="Button2" />
                    <ribbon:RibbonButton x:Name="Button3"
                                         SmallImageSource="Images\SmallIcon.png"
                                         Label="Button3" />
                    <ribbon:RibbonButton x:Name="Button4"
                                         SmallImageSource="Images\SmallIcon.png"
                                         Label="Button4" />                   
                </ribbon:RibbonGroup>
            </ribbon:RibbonTab>
        </ribbon:Ribbon>     
    </Grid>
</ribbon:RibbonWindow>

Remarks

A ribbon is a command bar that organizes the features of an application into a series of tabs at the top of the application window. It replaces both the traditional menu bar and toolbars.

The Ribbon class is the root element of a ribbon user interface (UI) in Windows Presentation Foundation (WPF). The Ribbon class hosts a RibbonQuickAccessToolBar, a RibbonApplicationMenu, and one or more RibbonTab controls. These controls then host a variety of button and menu controls that enable access to application commands.

The following list shows the typical hierarchy of ribbon elements.

Constructors

Ribbon()

Initializes a new instance of the Ribbon class.

Fields

Application​Menu​Property

Identifies the ApplicationMenu dependency property.

Checked​Background​Property

Identifies the CheckedBackground dependency property.

Checked​Border​Brush​Property

Identifies the CheckedBorderBrush dependency property.

Collapsed​Event

Identifies the Collapsed routed event.

Contextual​Tab​Group​Header​Template​Property

Identifies the ContextualTabGroupHeaderTemplate dependency property.

Contextual​Tab​Groups​Source​Property

Identifies the ContextualTabGroupsSource dependency property.

Contextual​Tab​Group​Style​Property

Identifies the ContextualTabGroupStyle dependency property.

Expanded​Event

Identifies the Expanded routed event.

Focused​Background​Property

Identifies the FocusedBackground dependency property.

Focused​Border​Brush​Property

Identifies the FocusedBorderBrush dependency property.

Help​Pane​Content​Property

Identifies the HelpPaneContent dependency property.

Help​Pane​Content​Template​Property

Identifies the HelpPaneContentTemplate dependency property.

Is​Collapsed​Property

Identifies the IsCollapsed dependency property.

Is​Drop​Down​Open​Property

Identifies the IsDropDownOpen dependency property.

Is​Hosted​In​Ribbon​Window​Property

Identifies the IsHostedInRibbonWindow dependency property.

Is​Minimized​Property

Identifies the IsMinimized dependency property.

Mouse​Over​Background​Property

Identifies the MouseOverBackground dependency property.

Mouse​Over​Border​Brush​Property

Identifies the MouseOverBorderBrush dependency property.

Pressed​Background​Property

Identifies the PressedBackground dependency property.

Pressed​Border​Brush​Property

Identifies the PressedBorderBrush dependency property.

Quick​Access​Tool​Bar​Property

Identifies the QuickAccessToolBar dependency property.

Show​Quick​Access​Tool​Bar​On​Top​Property

Identifies the ShowQuickAccessToolBarOnTop dependency property.

Tab​Header​Style​Property

Identifies the TabHeaderStyle dependency property.

Tab​Header​Template​Property

Identifies the TabHeaderTemplate dependency property.

Title​Property

Identifies the Title dependency property.

Title​Template​Property

Identifies the TitleTemplate dependency property.

Window​Icon​Visibility​Property

Identifies the WindowIconVisibility dependency property.

Properties

Application​Menu

Gets or sets the RibbonApplicationMenu that is a logical child of this Ribbon control.

Checked​Background

Gets or sets the brush that is used to draw the background of Ribbon controls when they are in the Checked state.

Checked​Border​Brush

Gets or sets the brush that is used to draw the outer border of Ribbon controls when they are in the Checked state.

Contextual​Tab​Group​Header​Template

Gets or sets the template that is used to display Header items in the RibbonContextualTabGroup.

Contextual​Tab​Groups

Gets a collection that contains all of the RibbonContextualTabGroup items in the Ribbon.

Contextual​Tab​Groups​Source

Gets or sets a collection used to generate the content of RibbonContextualTabGroup items.

Contextual​Tab​Group​Style

Gets or sets the style that is used when rendering RibbonContextualTabGroup items in the Ribbon.

Focused​Background

Gets or sets the brush used to draw the background of Ribbon controls in the Focused state.

Focused​Border​Brush

Gets or sets the brush used to draw the outer border of Ribbon controls in the Focused state.

Help​Pane​Content

Gets or sets the contents of the help pane.

Help​Pane​Content​Template

Gets or sets the template that is used to display the content of the help pane.

Is​Collapsed

Gets or sets a value that indicates whether the Ribbon is collapsed.

Is​Drop​Down​Open

Gets or sets a value that indicates whether the drop-down for a RibbonTab is open.

Is​Hosted​In​Ribbon​Window

Gets a value that indicates whether the Ribbon is currently hosted in a RibbonWindow.

Is​Minimized

Gets or sets a value that indicates whether the Ribbon is minimized.

Logical​Children

Gets an IEnumerator that iterates through the child elements of the Ribbon.

Mouse​Over​Background

Gets or sets the brush that is used to draw the background of Ribbon controls when they are in the MouseOver state.

Mouse​Over​Border​Brush

Gets or sets the brush that is used to draw the outer border of Ribbon controls when they are in the MouseOver state.

Pressed​Background

Gets or sets the brush that is used to draw the background of Ribbon controls when they are in the Pressed state.

Pressed​Border​Brush

Gets or sets the brush that is used to draw the outer border of Ribbon controls when they are in the Pressed state.

Quick​Access​Tool​Bar

Gets or sets the RibbonQuickAccessToolBar that is a logical child of this Ribbon.

Show​Quick​Access​Tool​Bar​On​Top

Gets or sets a value that indicates whether to show the Quick Access Toolbar above the Ribbon.

Tab​Header​Style

Gets or sets the style that is used when rendering tab headers.

Tab​Header​Template

Gets or sets the template that is used to display tab headers.

Title

Gets or sets the title of this Ribbon control.

Title​Template

Gets or sets the template that is used to display the Ribbon title.

Window​Icon​Visibility

Gets or sets the Visibility for the icon of the RibbonWindow that contains this Ribbon.

Methods

Get​Container​For​Item​Override()

Returns a new RibbonTab object.

Is​Item​Its​Own​Container​Override(​Object)

Returns a value that indicates whether the specified item is (or is eligible to be) its own container.

On​Apply​Template()

Builds the visual tree for the Ribbon when a new template is applied.

On​Create​Automation​Peer()

Creates a new RibbonAutomationPeer object for this control.

On​Items​Changed(​Notify​Collection​Changed​Event​Args)

Updates the current selection and synchronizes the headers when an item is changed in the Ribbon.

On​Key​Down(​Key​Event​Args)

Provides class handling for the KeyDown event.

On​Mouse​Down(​Mouse​Button​Event​Args)

Provides class handling for the MouseDown event.

On​Preview​Mouse​Down(​Mouse​Button​Event​Args)

Provides class handling for the PreviewMouseDown event.

On​Preview​Mouse​Wheel(​Mouse​Wheel​Event​Args)

Provides class handling for the MouseWheel event.

On​Selection​Changed(​Selection​Changed​Event​Args)

Provides class handling for the SelectionChanged event.

Prepare​Container​For​Item​Override(​Dependency​Object, ​Object)

Prepares the specified element to display the specified item.

Events

Collapsed

Occurs when the IsCollapsed property is changed to true and the Ribbon is collapsed.

Expanded

Occurs when the IsCollapsed property is changed to false and the Ribbon is expanded.