BinaryRibbonApplicationMenu
The 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.
public class BinaryRibbonApplicationMenu : MenuItem, IBinaryRibbonKeyTipControl, IBinaryRibbonApplicationMenu
Inherits from / implements: MenuItem, IBinaryRibbonKeyTipControl, IBinaryRibbonApplicationMenu
Remarks
Assign it to BinaryRibbonBarPanel.ApplicationMenu. Its items are the commands on
the left: use BinaryRibbonApplicationMenuItem for the large-picture entries Office
shows, with sub-items for a submenu, and Separator between groups of them; any other
item is wrapped in a BinaryRibbonMenuItem. A click on any of them closes the menu.
The right-hand column shows RecentItemsDataSource drawn with
RecentItemsTemplate, under HeaderContent – by default a "Recent
Documents" heading. FooterContent runs across the foot of the menu. ButtonImage is the
picture on the button.
For a menu that opens across the window instead, use
BinaryRibbonBackstageApplicationMenu.
Examples
The window's data context has a RecentFiles collection of objects with a
FileName property.
<bm:BinaryRibbonApplicationMenu ButtonImage="Images/AppButton.png" RecentItemsDataSource="{Binding RecentFiles}">
<bm:BinaryRibbonApplicationMenu.RecentItemsTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Margin="8,4" Text="{Binding FileName}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</bm:BinaryRibbonApplicationMenu.RecentItemsTemplate>
<bm:BinaryRibbonApplicationMenuItem Header="New invoice" Image="Images/New32.png" Click="OnNew" />
<bm:BinaryRibbonApplicationMenuItem Header="Save As" Image="Images/SaveAs32.png" SubMenuTitleContent="Save a copy of the invoice">
<bm:BinaryRibbonApplicationMenuItem Header="PDF document" Image="Images/Pdf32.png" Click="OnSaveAsPdf" />
<bm:BinaryRibbonApplicationMenuItem Header="Excel workbook" Image="Images/Excel32.png" Click="OnSaveAsExcel" />
</bm:BinaryRibbonApplicationMenuItem>
<Separator />
<bm:BinaryRibbonApplicationMenuItem Header="Exit" Image="Images/Exit32.png" Click="OnExit" />
</bm:BinaryRibbonApplicationMenu>See also
Members at a glance
| Constructors | |
|---|---|
BinaryRibbonApplicationMenu | Creates an empty application menu. A click on any of its items closes it. |
| Properties | |
ButtonImage | Gets or sets the picture on the application button. |
FooterContent | Gets or sets what is shown at the foot of the menu – typically an Options and an Exit button, as in Office. |
FooterDataTemplate | Gets or sets the template that draws FooterContent. |
HeaderContent | Gets or sets what is shown at the top of the right-hand column, above the recent items. |
HeaderDataTemplate | Gets or sets the template that draws HeaderContent. |
IsOpen | Gets or sets whether the menu is open. |
RecentItems | Gets or sets recent items content that the built-in template does not show. |
RecentItemsDataSource | Gets or sets what the right-hand column lists – usually the recently opened documents. |
RecentItemsTemplate | Gets or sets the template that draws RecentItemsDataSource in the right-hand column. |
| Methods | |
GetContainerForItemOverride | Creates the BinaryRibbonMenuItem that an item other than a ribbon menu item or a
separator is shown in. |
IsItemItsOwnContainerOverride | Reports whether an item is shown as it is: a BinaryRibbonMenuItem (an
BinaryRibbonApplicationMenuItem among them) or a Separator is; anything
else is wrapped. |
OnApplyTemplate | Takes the template's button, drop-down and recent items column. |
OnPopupWindowClosed | Called when the menu's drop-down closes; the base implementation clears IsOpen. |
OnPopupWindowOpen | Called when the menu's drop-down opens; the base implementation lines up the copy of the application
button drawn over the menu, and sets IsOpen. |
| Fields | |
ButtonImageProperty | Identifies the ButtonImage dependency property. |
FooterContentProperty | Identifies the FooterContent dependency property. |
FooterDataTemplateProperty | Identifies the FooterDataTemplate dependency property. |
HeaderContentProperty | Identifies the HeaderContent dependency property. |
HeaderDataTemplateProperty | Identifies the HeaderDataTemplate dependency property. |
IsOpenProperty | Identifies the IsOpen dependency property. |
RecentItemsDataSourceProperty | Identifies the RecentItemsDataSource dependency property. |
RecentItemsProperty | Identifies the RecentItems dependency property. |
RecentItemsTemplateProperty | Identifies the RecentItemsTemplate dependency property. |
Constructors
Properties
ButtonImage
Gets or sets the picture on the application button.
- Value
- The default is the current skin's application button picture.
Remarks
While BinaryRibbonBuiltInSkinController.Skin is RibbonSkin.Windows7, a
picture assigned here is replaced by the built-in Windows 7 one.
HeaderContent
Gets or sets what is shown at the top of the right-hand column, above the recent items.
- Value
- The default is
null; with the built-inHeaderDataTemplatethe column is headed "Recent Documents".
HeaderDataTemplate
Gets or sets the template that draws HeaderContent.
- Value
- The built-in style supplies one that draws a bold "Recent Documents" heading; replace it to head the column with something else.
IsOpen
Gets or sets whether the menu is open.
- Value
- The default is
false.
Remarks
The application button, its key tip and a click on a menu item change it. Opening or closing the menu
also closes the commands of a tabs-only ribbon if they are dropped down
(BinaryRibbonBarPanel.CollapseRibbonBarCommand).
RecentItems
Gets or sets recent items content that the built-in template does not show.
- Value
- The default is
null.
Remarks
Set RecentItemsDataSource to fill the right-hand column.
RecentItemsDataSource
Gets or sets what the right-hand column lists – usually the recently opened documents.
- Value
- Any object, drawn with
RecentItemsTemplate; for a list, a collection whose template is anItemsControlbound to it. The default isnull.
RecentItemsTemplate
Gets or sets the template that draws RecentItemsDataSource in the right-hand column.
- Value
- The default is
null, which shows the object as it is (a string as text).
Methods
GetContainerForItemOverride
Creates the BinaryRibbonMenuItem that an item other than a ribbon menu item or a
separator is shown in.
Returns
A new BinaryRibbonMenuItem.
IsItemItsOwnContainerOverride
Reports whether an item is shown as it is: a BinaryRibbonMenuItem (an
BinaryRibbonApplicationMenuItem among them) or a Separator is; anything
else is wrapped.
Parameters
item- The item.
Returns
true for a ribbon menu item or a separator.
OnApplyTemplate
Takes the template's button, drop-down and recent items column.
OnPopupWindowClosed
Called when the menu's drop-down closes; the base implementation clears IsOpen.
Parameters
sender- The drop-down.
e- Not used.
OnPopupWindowOpen
Called when the menu's drop-down opens; the base implementation lines up the copy of the application
button drawn over the menu, and sets IsOpen.
Parameters
sender- The drop-down.
e- Not used.
Fields
ButtonImageProperty static
Identifies the ButtonImage dependency property.
HeaderContentProperty static
Identifies the HeaderContent dependency property.
HeaderDataTemplateProperty static
Identifies the HeaderDataTemplate dependency property.
IsOpenProperty static
Identifies the IsOpen dependency property.
RecentItemsDataSourceProperty static
Identifies the RecentItemsDataSource dependency property.
RecentItemsProperty static
Identifies the RecentItems dependency property.
RecentItemsTemplateProperty static
Identifies the RecentItemsTemplate dependency property.