BinaryRibbonBarPanel
BinaryRibbonBarPanel also known as Ribbon bar, is the Ribbon panel control where you can host all ribbon child controls.
public partial class BinaryRibbonBarPanel : Control
Inherits from / implements: Control
Remarks
How this control works. The ribbon is a tab strip over one group panel. Its content is Tabs; the selected tab's groups are laid out by the group panel ( PART_GroupPanel ), and when the ribbon is collapsed the same groups drop over the document in a popup ( PART_Popup , PART_PopupGroupPanel ) when a tab is clicked. One concern per partial file: DisplayState (how much of the ribbon shows; Ctrl+F1), Layout (classic or simplified), QuickAccess (the context menu and the quick access toolbar), Density (touch mode) and Resources (what it merges into the application). When the groups do not fit, they give way one at a time from the far end, each becoming a single drop-down button, with a measure after each; galleries shrink first. Skins. Colours and shapes are resources keyed by BinaryRibbonThemeResources . BinaryRibbonBuiltInSkinController.Skin swaps the dictionary that defines them: the Office skins from XAML, the colour skins from tables in code, and the Fluent skins from the skin manager's palette, which the rest of the suite follows too. Keyboard and tips. Key tips ( BinaryKeyTip.AccessKey ) show on Alt or F10, level by level: a tab's tip, then its commands'. Screen tips ( BinaryRibbonScreenTip ) attach to any command, with F1 for help; galleries raise live-preview routed events for an application to preview, commit or cancel a change. Right to left follows the window's FlowDirection, with command pictures left unmirrored.
Members at a glance
BinaryRibbonBarPanel | Initializes a new instance of the BinaryRibbonBarPanel class. |
AlignGroupsLeftCommand | Gets the "align groups to left" Routed UI command. |
AlignGroupsRightCommand | Gets the "align groups right" command. |
ApplicationMenu | Gets or sets the instance of the BinaryRibbonApplicationMenu. |
BackgroundColor | Gets or sets the background color. |
CanMinimize | Gets or sets whether only the tab strip is shown, with the commands dropped over the document when a tab is chosen. |
CanUserChangeRibbonLayout | Gets or sets whether the user is offered the choice between the classic and the simplified ribbon. |
CollapseRibbonBarCommand | Gets the "collapse ribbon bar" command. |
ContextualTabSet | Gets or sets the contextual tab set. |
ContextualTabSets | Gets the contextual tab sets. |
CurrentlyVisibleTabItems | Gets the currently visible tab items. |
DisplayState | Gets or sets how much of the ribbon is on screen. |
IsDisplayStateShortcutEnabled | Gets or sets whether Ctrl+F1 switches the ribbon between its display states. |
IsExpanded | Gets or sets a value indicating whether this instance is expanded. |
IsMenuOpen | Gets or sets a value indicating whether the application menu instance is currently open. |
IsMinimized | Gets or sets a value indicating whether this instance is currently minimized. |
IsRibbonContextMenuEnabled | Gets or sets whether right-clicking the ribbon offers its own context menu. |
IsRibbonControlVisible | Gets or sets a value indicating whether this ribbon control instance is visible. |
IsTouchMode | Gets whether the ribbon is laid out for touch: each small command on a taller row and space between the columns, as Office's touch mode has them. |
LogicalChildren | Gets the children this element contributes to the logical tree. |
QuickAccessToolBar | Gets or sets the Quick Access Toolbar (QAT) instance. |
RibbonLayout | Gets or sets how the ribbon lays its commands out. |
SelectedGroups | Gets or sets the selected groups. |
SelectedTabIndex | Gets or sets the index of the selected tab. |
SelectedTabItem | Gets or sets the selected tab item. |
Tabs | Gets the collection of tabs in the control. |
TitleText | Gets or sets the window title text. |
ToolbarPlacementLocation | Gets or sets the toolbar placement location. |
AddToQuickAccessToolBar | Puts a command on the quick access toolbar. |
ArrangeOverride | Places the children within the space this element was given, and reports the space it actually used. |
GetCommandId | Gets the identity a ribbon command is remembered by. |
GetMaxSize | Gets the maximum size mode. |
GetMinSize | Gets the minimum size mode. |
GetQuickAccessSource | Gets the command a quick access toolbar shortcut stands for. |
GetQuickAccessToolBarState | What the quick access toolbar holds, and where it sits, as one string. |
GetResizableSize | Gets the resizable size colection. |
GetSize | Gets the size mode the control is currently in. |
IndexOfVisibleTab | A helper method to return the visible index of the given tab item. |
OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. |
OnContextualTabSetChanged | Called when the ContextualTabSet dependency property changes. |
OnContextualTabSetsChanged | Called when the contextual tab sets collection changes, which is where this control brings its layout back in step with its contents. |
OnIsBarExpandedChanged | Called when the IsBarExpanded dependency property changes. |
OnLostKeyboardFocus | Raises the LostKeyboardFocus event. BinaryRibbonBarPanel overrides it so the control's own handling runs alongside the base behavior. |
OnLostMouseCapture | Raises the LostMouseCapture event. BinaryRibbonBarPanel overrides it so the control's own handling runs alongside the base behavior. |
OnPopupClose | Called when this control's drop-down popup closes. Override to react to it without having to attach to the popup yourself. |
OnPopupOpen | Called when this control's drop-down popup opens. Override to react to it without having to attach to the popup yourself. |
OnPreviewMouseLeftButtonDown | Raises the PreviewMouseLeftButtonDown event. BinaryRibbonBarPanel overrides it so the control's own handling runs alongside the base behavior. |
OnPreviewMouseRightButtonUp | Raises the PreviewMouseRightButtonUp event. |
OnSelectedGroupsChangedCallback | Called when the SelectedGroups dependency property changes. |
OnSelectedTabIndexChanged | Called when the SelectedTabIndex dependency property changes. |
OnTabItemCollectionChanged | Called when the tab item collection changes, which is where this control brings its layout back in step with its contents. |
OnVisualParentChanged | Called when this element is moved to a different visual parent. |
RemoveFromQuickAccessToolBar | Takes a command off the quick access toolbar. |
SetCommandId | Sets the identity a ribbon command is remembered by. |
SetGroupRenderingAlignment | Sets how the groups on the current tab are aligned along the bar. The base does nothing; a derived bar overrides it to lay its groups out its own way. |
SetMaxSize | Sets the maximum size mode. |
SetMinSize | Sets the minimum size mode. |
SetQuickAccessSource | Sets the command a quick access toolbar shortcut stands for. |
SetQuickAccessToolBarState | Puts the quick access toolbar back as it was. |
SetResizableSize | Gets the resizable size colection. |
SetSize | Sets the size mode the control is currently to be in. |
ToggleDisplayState | Switches between showing the commands and showing only the tabs. |
ToggleRibbonLayout | Switches between the classic and the simplified ribbon. |
VisibleTabFromIndex | A helper method to return the visible tabl item, given an index. |
SelectedTabIndexChanged | Occurs when selected tab index changes. |
ApplicationMenuProperty | ApplicationMenuProperty property. |
BackgroundColorProperty | BackgroundColorProperty property. |
CanMinimizeProperty | CanMinimizeProperty property. |
CanUserChangeRibbonLayoutProperty | Identifies the CanUserChangeRibbonLayout dependency property. |
CommandIdProperty | Identifies the CommandId attached property. |
ContextualTabSetProperty | ContextualTabSetProperty property. |
DisplayStateProperty | Identifies the DisplayState dependency property. |
IsDisplayStateShortcutEnabledProperty | Identifies the IsDisplayStateShortcutEnabled dependency property. |
IsExpandedProperty | IsExpandedProperty property. |
IsMenuOpenProperty | IsMenuOpenProperty property. |
IsMinimizedProperty | IsMinimizedProperty property. |
IsRibbonContextMenuEnabledProperty | Identifies the IsRibbonContextMenuEnabled dependency property. |
IsRibbonControlVisibleProperty | IsRibbonControlVisibleProperty property. |
MaxSizeProperty | MaxSizeProperty attached property. |
MinSizeProperty | MinSizeProperty attached property. |
QuickAccessSourceProperty | Identifies the QuickAccessSource attached property. |
QuickAccessToolBarProperty | QuickAccessToolBarProperty property. |
ResizableSizeProperty | ResizableSizeProperty attached property. |
RibbonLayoutProperty | Identifies the RibbonLayout dependency property. |
SelectedGroupsProperty | SelectedGroupsProperty property. |
SelectedTabIndexChangedEvent | SelectedTabIndexChangedEvent Routed event instance. |
SelectedTabIndexProperty | SelectedTabIndexProperty property. |
SizeProperty | SizeProperty attached property. |
TitleTextProperty | TitleTextProperty property. |
ToolbarPlacementLocationProperty | ToolbarPlacementLocationProperty property. |
Constructors
BinaryRibbonBarPanel
Initializes a new instance of the BinaryRibbonBarPanel class.
Properties
AlignGroupsLeftCommand
Gets the "align groups to left" Routed UI command.
AlignGroupsRightCommand
Gets the "align groups right" command.
Value. The align groups right command.
BackgroundColor
Gets or sets the background color.
CanMinimize
Gets or sets whether only the tab strip is shown, with the commands dropped over the document when a tab is chosen.
Value. true while only the tabs are shown. The default is false .
DisplayState, which is the one to use in new code. Setting either moves the other.CanUserChangeRibbonLayout
Gets or sets whether the user is offered the choice between the classic and the simplified ribbon.
Value. true to offer it. The default is true .
RibbonLayout still works from code.CollapseRibbonBarCommand
Gets the "collapse ribbon bar" command.
Value. The collapse ribbon bar command.
ContextualTabSet
Gets or sets the contextual tab set.
Value. The contextual tab set.
ContextualTabSets
Gets the contextual tab sets.
Value. The contextual tab sets.
CurrentlyVisibleTabItems
Gets the currently visible tab items.
Value. The currently visible tab items.
DisplayState
Gets or sets how much of the ribbon is on screen.
Value. The display state. The default is ShowTabsAndCommands.
CanMinimize are two names for one state and are kept in step: CanMinimize is the older spelling, kept because applications are built against it, and it reads as a capability while it has always been a state. New code should use this property, which says what it means and has room for the states still to come.IsDisplayStateShortcutEnabled
Gets or sets whether Ctrl+F1 switches the ribbon between its display states.
Value. true to answer the key. The default is true .
IsExpanded
Gets or sets a value indicating whether this instance is expanded.
Value. true if this instance is expanded; otherwise, false .
IsMinimized
Gets or sets a value indicating whether this instance is currently minimized.
Value. true if this instance is minimized; otherwise, false .
IsRibbonControlVisible
Gets or sets a value indicating whether this ribbon control instance is visible.
IsTouchMode
Gets whether the ribbon is laid out for touch: each small command on a taller row and space between the columns, as Office's touch mode has them.
Value. true while BinarySkinManager.Density is Touch. The density is the application's, so every ribbon in it follows the same setting; set it there - an application offering Office's Touch/Mouse Mode command sets it from that.
LogicalChildren
Gets the children this element contributes to the logical tree.
QuickAccessToolBar
Gets or sets the Quick Access Toolbar (QAT) instance.
RibbonLayout
Gets or sets how the ribbon lays its commands out.
Value. The layout. The default is Classic.
DisplayState: a simplified ribbon can still show only its tabs, or hide altogether, and the commands it drops over the document are then a single line as well. The ribbon saves nothing itself; an application that wants the user's choice to survive a restart stores this value with its other settings.SelectedGroups
Gets or sets the selected groups.
Value. The selected groups.
SelectedTabIndex
Gets or sets the index of the selected tab.
Value. The index of the selected tab.
SelectedTabItem
Gets or sets the selected tab item.
Value. The selected tab item.
Tabs
Gets the collection of tabs in the control.
TitleText
Gets or sets the window title text.
Value. The title text.
ToolbarPlacementLocation
Gets or sets the toolbar placement location.
Value. The toolbar placement location.
Methods
AddToQuickAccessToolBar
Puts a command on the quick access toolbar.
- command
- The command, which stays where it is on the ribbon.
ArrangeOverride
Places the children within the space this element was given, and reports the space it actually used.
GetCommandId
Gets the identity a ribbon command is remembered by.
- element
- The command.
Returns. The identity, or null if it has none.
GetMaxSize
Gets the maximum size mode.
- obj
- The obj.
GetMinSize
Gets the minimum size mode.
GetQuickAccessSource
Gets the command a quick access toolbar shortcut stands for.
- element
- The shortcut on the toolbar.
Returns. The command on the ribbon, or null if this is not a shortcut.
GetQuickAccessToolBarState
What the quick access toolbar holds, and where it sits, as one string.
Returns. A string to keep and hand back to SetQuickAccessToolBarState, or an empty string when there is nothing to remember.
CommandIdProperty can be written down.GetResizableSize
Gets the resizable size colection.
GetSize
Gets the size mode the control is currently in.
IndexOfVisibleTab
A helper method to return the visible index of the given tab item.
- tabItem
- The tab item.
OnApplyTemplate
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate.
OnContextualTabSetChanged
Called when the ContextualTabSet dependency property changes.
- e
- The old and new values of the property.
OnContextualTabSetsChanged
Called when the contextual tab sets collection changes, which is where this control brings its layout back in step with its contents.
- sender
- The collection that changed.
- e
- What was added, removed or moved.
OnIsBarExpandedChanged
Called when the IsBarExpanded dependency property changes.
- e
- The old and new values of the property.
OnLostKeyboardFocus
Raises the LostKeyboardFocus event. BinaryRibbonBarPanel overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
OnLostMouseCapture
Raises the LostMouseCapture event. BinaryRibbonBarPanel overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
OnPopupClose
Called when this control's drop-down popup closes. Override to react to it without having to attach to the popup yourself.
- sender
- The popup.
- e
- Not used.
OnPopupOpen
Called when this control's drop-down popup opens. Override to react to it without having to attach to the popup yourself.
- sender
- The popup.
- e
- Not used.
OnPreviewMouseLeftButtonDown
Raises the PreviewMouseLeftButtonDown event. BinaryRibbonBarPanel overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
OnPreviewMouseRightButtonUp
Raises the PreviewMouseRightButtonUp event.
- e
- The data for the event.
OnSelectedGroupsChangedCallback
Called when the SelectedGroups dependency property changes.
- e
- The old and new values of the property.
OnSelectedTabIndexChanged
Called when the SelectedTabIndex dependency property changes.
- e
- The old and new values of the property.
OnTabItemCollectionChanged
Called when the tab item collection changes, which is where this control brings its layout back in step with its contents.
- sender
- The collection that changed.
- e
- What was added, removed or moved.
OnVisualParentChanged
Called when this element is moved to a different visual parent.
RemoveFromQuickAccessToolBar
Takes a command off the quick access toolbar.
- command
- The command, or the shortcut standing for it.
SetCommandId
Sets the identity a ribbon command is remembered by.
- element
- The command.
- value
- An identity, unique within this ribbon and stable between runs.
SetGroupRenderingAlignment
Sets how the groups on the current tab are aligned along the bar. The base does nothing; a derived bar overrides it to lay its groups out its own way.
- alignment
- The alignment to apply.
SetMaxSize
Sets the maximum size mode.
- obj
- The obj.
- value
- The value.
SetMinSize
Sets the minimum size mode.
SetQuickAccessSource
Sets the command a quick access toolbar shortcut stands for.
- element
- The shortcut on the toolbar.
- value
- The command on the ribbon.
SetQuickAccessToolBarState
Puts the quick access toolbar back as it was.
- state
- What
GetQuickAccessToolBarStatereturned.
SetResizableSize
Gets the resizable size colection.
SetSize
Sets the size mode the control is currently to be in.
ToggleDisplayState
Switches between showing the commands and showing only the tabs.
ShowTabsAndCommands it brings the whole ribbon back, so that it is always the way out of a ribbon that is not on screen.ToggleRibbonLayout
Switches between the classic and the simplified ribbon.
VisibleTabFromIndex
A helper method to return the visible tabl item, given an index.
- index
- The index.
Events
SelectedTabIndexChanged
Occurs when selected tab index changes.
Fields
BackgroundColorProperty
BackgroundColorProperty property.
CanMinimizeProperty
CanMinimizeProperty property.
CanUserChangeRibbonLayoutProperty
Identifies the CanUserChangeRibbonLayout dependency property.
CommandIdProperty
Identifies the CommandId attached property.
ContextualTabSetProperty
ContextualTabSetProperty property.
DisplayStateProperty
Identifies the DisplayState dependency property.
IsDisplayStateShortcutEnabledProperty
Identifies the IsDisplayStateShortcutEnabled dependency property.
IsExpandedProperty
IsExpandedProperty property.
IsMinimizedProperty
IsMinimizedProperty property.
IsRibbonControlVisibleProperty
IsRibbonControlVisibleProperty property.
MaxSizeProperty
MaxSizeProperty attached property.
MinSizeProperty
MinSizeProperty attached property.
QuickAccessSourceProperty
Identifies the QuickAccessSource attached property.
QuickAccessToolBarProperty
QuickAccessToolBarProperty property.
ResizableSizeProperty
ResizableSizeProperty attached property.
RibbonLayoutProperty
Identifies the RibbonLayout dependency property.
SelectedGroupsProperty
SelectedGroupsProperty property.
SelectedTabIndexChangedEvent
SelectedTabIndexChangedEvent Routed event instance.
SelectedTabIndexProperty
SelectedTabIndexProperty property.
SizeProperty
SizeProperty attached property.
TitleTextProperty
TitleTextProperty property.
ToolbarPlacementLocationProperty
ToolbarPlacementLocationProperty property.