📜 ⬆️ ⬇️

Microsoft Ribbon Release for WPF Released

I am pleased to inform you about the release of the final version of Microsoft Ribbon for WPF.



The new control is compatible with WPF 3.5 SP1 and WPF 4. It is not a wrapper over unmanaged code, but is entirely written in WPF, which means full compatibility with WPF style management capabilities.
')

Application template


The installer contains a new template “WPF Ribbon Application” for Visual Studio.



After creating and launching a new project, you will see a blank for your tape.



This is what the XAML code for this tape looks like:

< ribbon:Ribbon x:Name ="Ribbon" >

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


* This source code was highlighted with Source Code Highlighter .


The window containing the tape inherits from the class RibbonWindow. This class allows you to work with the window title bar (which is not included in the ClientArea and is inaccessible for drawing in a normal Window - approx. Transl.) And display controls on it, such as the quick access toolbar and the context tab headers. You may not use this class, however, in this case, you will not be able to work with the window title.

The new ribbon contains all the features that you expected to find in it: the quick access toolbar, application menu, auxiliary panels, advanced prompts, keyboard shortcuts, automatic resizing and location, tabs, contextual tab headers, aero support, etc. P.

Context Tabs


Let's add a new tab and nest it into the group of contextual tabs (for example, table editing tools in Word). You need to add the following code to the XAML tape:

< ribbon:RibbonTab x:Name ="AwesomeTab"
ContextualTabGroupHeader ="Awesome Tools"
Header ="Really Awesome" >
< ribbon:RibbonGroup x:Name ="Group2"
Header ="Group2" >
< ribbon:RibbonButton x:Name ="Button21"
LargeImageSource ="Images\LargeIcon.png"
Label ="Button21" />
</ ribbon:RibbonGroup >

</ ribbon:RibbonTab >
< ribbon:Ribbon.ContextualTabGroups >
< ribbon:RibbonContextualTabGroup Header ="Awesome Tools"
Visibility ="Visible"
Background ="Green" />
</ ribbon:Ribbon.ContextualTabGroups >


* This source code was highlighted with Source Code Highlighter .




Note the changes in the window code to support the context group header.

Quick Access Toolbar


As you expected, the tape supports the quick access toolbar. XAML code:

< ribbon:Ribbon.QuickAccessToolBar >
< ribbon:RibbonQuickAccessToolBar >
< ribbon:RibbonButton x:Name ="ButtonQ1"
SmallImageSource ="Images\SmallIcon.png"
Label ="ButtonQ1" />
< ribbon:RibbonButton x:Name ="ButtonQ2"
SmallImageSource ="Images\SmallIcon.png"
Label ="ButtonQ2" />
< ribbon:RibbonButton x:Name ="ButtonQ3"
SmallImageSource ="Images\SmallIcon.png"
Label ="ButtonQ3" />
</ ribbon:RibbonQuickAccessToolBar >
</ ribbon:Ribbon.QuickAccessToolBar >

* This source code was highlighted with Source Code Highlighter .




The screenshot shows two shortcut buttons and a double arrow indicating that several more buttons are available.

The WPF Ribbon development team did a great job in creating this control. It supports additional scenarios needed when used in a wide range of tasks. There is also full support for the Windows 7 user interface style. It's nice to see that WPF Ribbon is released and available for use in your projects.

PS And yes: RibbonButton supports ICommand)

References:

Source: https://habr.com/ru/post/100833/


All Articles