HypernovaDesktop Components · docs
Binarymission
WPF › Ribbon › BinaryRibbonQuickAccessToolBar

BinaryRibbonQuickAccessToolBar

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Office

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

public class BinaryRibbonQuickAccessToolBar : ItemsControl, IBinaryRibbonKeyTipControl

Inherits from / implements: ItemsControl, IBinaryRibbonKeyTipControl

Remarks

Assign it to BinaryRibbonBarPanel.QuickAccessToolBar. Ribbon commands among its items – BinaryRibbonButton, BinaryRibbonToggleButtonControl, BinaryRibbonDropDownButton and the like – go on the bar, drawn small (a picture alone). Any other item, such as a MenuItem, goes into the toolbar's drop-down menu, between HeaderContent (by default a "Customize the QAT" heading) and FooterContent; the drop-down arrow appears only when there is such an item.

Users add commands from the ribbon by right-clicking them, and the ribbon can save and restore their choice (BinaryRibbonBarPanel.GetQuickAccessToolBarState). Whether the toolbar sits above or below the ribbon is the ribbon's BinaryRibbonBarPanel.ToolbarPlacementLocation; its height in the caption is the window's BinaryRibbonWindow.QATPanelHeight.

Examples

<bm:BinaryRibbonBarPanel.QuickAccessToolBar>
    <bm:BinaryRibbonQuickAccessToolBar>
        <bm:BinaryRibbonButton SmallImage="Images/Save16.png" ToolTip="Save (Ctrl+S)" Command="ApplicationCommands.Save" />
        <bm:BinaryRibbonButton SmallImage="Images/Undo16.png" ToolTip="Undo" Command="ApplicationCommands.Undo" />
        <bm:BinaryRibbonButton SmallImage="Images/Redo16.png" ToolTip="Redo" Command="ApplicationCommands.Redo" />
        <MenuItem Header="Show below the ribbon" Click="OnQuickAccessBelow" />
    </bm:BinaryRibbonQuickAccessToolBar>
</bm:BinaryRibbonBarPanel.QuickAccessToolBar>

See also

Members at a glance

Constructors
BinaryRibbonQuickAccessToolBarCreates an empty quick access toolbar. A click on any of its commands or menu items closes its drop-downs.
Properties
FooterContentGets or sets what is shown at the foot of the toolbar's drop-down menu, below its menu items.
FooterDataTemplateGets or sets the template that draws FooterContent.
HasContentOverflowItemsGets or sets whether some commands did not fit and were moved to the overflow drop-down.
HasItemsGets or sets whether the toolbar has menu items – items other than ribbon commands – to show in its drop-down menu.
HeaderContentGets or sets what is shown at the top of the toolbar's drop-down menu, above its menu items.
HeaderDataTemplateGets or sets the template that draws HeaderContent.
IsContentOverflowWindowShowingGets or sets whether the overflow drop-down, holding the commands that did not fit, is open.
IsOpenGets or sets whether the toolbar's drop-down menu is open.
ItemsTemplateGets or sets a template for the part of the drop-down menu that holds the menu items.
ToolBarPlacementLocationGets or sets whether the toolbar is drawn for its place above the tabs or below the ribbon.
Methods
GetQuickAccessChildPlacementGets where an item of the toolbar is meant to appear: on the bar, in the menu, or both.
MeasureOverridePuts the ribbon commands on the bar, drawn small, and the other items in the menu; commands that do not fit the width are moved to the template's PART_OverflowItemsHost panel, when it has one.
OnApplyTemplateTakes the template's panels for the bar, the overflow and the menu.
OnItemsChangedLays the toolbar out again when an item is added or removed, so that the change shows at once.
SetQuickAccessChildPlacementSets where an item of the toolbar is meant to appear: on the bar, in the menu, or both.
Fields
FooterContentPropertyIdentifies the FooterContent dependency property.
FooterDataTemplatePropertyIdentifies the FooterDataTemplate dependency property.
HasContentOverflowItemsPropertyIdentifies the HasContentOverflowItems dependency property.
HasItemsPropertyIdentifies the HasItems dependency property.
HeaderContentPropertyIdentifies the HeaderContent dependency property.
HeaderDataTemplatePropertyIdentifies the HeaderDataTemplate dependency property.
IsContentOverflowWindowShowingPropertyIdentifies the IsContentOverflowWindowShowing dependency property.
IsOpenPropertyIdentifies the IsOpen dependency property.
ItemsTemplatePropertyIdentifies the ItemsTemplate dependency property.
QuickAccessChildPlacementPropertyIdentifies the QuickAccessChildPlacement attached property.
ToolBarPlacementLocationPropertyIdentifies the ToolBarPlacementLocation dependency property.

Constructors

BinaryRibbonQuickAccessToolBar

public BinaryRibbonQuickAccessToolBar() : base()

Creates an empty quick access toolbar. A click on any of its commands or menu items closes its drop-downs.

Properties

FooterContent

public object FooterContent

Gets or sets what is shown at the foot of the toolbar's drop-down menu, below its menu items.

Value
The default is null: no footer.

FooterDataTemplate

public DataTemplate FooterDataTemplate

Gets or sets the template that draws FooterContent.

Value
The default is null.

HasContentOverflowItems

public bool HasContentOverflowItems

Gets or sets whether some commands did not fit and were moved to the overflow drop-down.

Value
Set by the toolbar each time it is measured. The default is false.
Remarks

While it is true the template shows the overflow button, and the menu items move into the overflow drop-down with the commands.

HasItems

public bool HasItems

Gets or sets whether the toolbar has menu items – items other than ribbon commands – to show in its drop-down menu.

Value
Set by the toolbar each time it lays its items out. The default is false.
Remarks

The drop-down arrow is shown only while this is true. It hides HasItems, which counts every item.

HeaderContent

public object HeaderContent

Gets or sets what is shown at the top of the toolbar's drop-down menu, above its menu items.

Value
The default is null; with the built-in HeaderDataTemplate the menu is headed "Customize the QAT".

HeaderDataTemplate

public DataTemplate HeaderDataTemplate

Gets or sets the template that draws HeaderContent.

Value
The built-in style supplies one that draws a bold "Customize the QAT" heading; set null to draw HeaderContent as it is.

IsContentOverflowWindowShowing

public bool IsContentOverflowWindowShowing

Gets or sets whether the overflow drop-down, holding the commands that did not fit, is open.

Value
The default is false. Binds two-way by default.
Remarks

Any change closes the menu drop-down (IsOpen).

IsOpen

public bool IsOpen

Gets or sets whether the toolbar's drop-down menu is open.

Value
The default is false. Binds two-way by default.

ItemsTemplate

public DataTemplate ItemsTemplate

Gets or sets a template for the part of the drop-down menu that holds the menu items.

Value
The default is null.

ToolBarPlacementLocation

public QuickAccessToolbarPlacementLocation ToolBarPlacementLocation

Gets or sets whether the toolbar is drawn for its place above the tabs or below the ribbon.

Value
The default is QuickAccessToolbarPlacementLocation.Top.
Remarks

Chooses the toolbar's template. The ribbon sets it when its own BinaryRibbonBarPanel.ToolbarPlacementLocation changes, which is what moves the toolbar; set that rather than this.

Methods

GetQuickAccessChildPlacement static

public static QuickAccessToolbarChildPlacementTarget GetQuickAccessChildPlacement(DependencyObject obj)

Gets where an item of the toolbar is meant to appear: on the bar, in the menu, or both.

Parameters
obj
The item.
Returns
Remarks

The built-in toolbar does not read it: an item's place follows from its type, as the class remarks describe.

MeasureOverride

protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint)

Puts the ribbon commands on the bar, drawn small, and the other items in the menu; commands that do not fit the width are moved to the template's PART_OverflowItemsHost panel, when it has one.

Parameters
constraint
The space available.
Returns

The space the toolbar needs.

OnApplyTemplate

public override void OnApplyTemplate()

Takes the template's panels for the bar, the overflow and the menu.

Exceptions
System.ArgumentException
The template has no panel named PART_ToolBarPanel.

OnItemsChanged

protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

Lays the toolbar out again when an item is added or removed, so that the change shows at once.

Parameters
e
What changed.

SetQuickAccessChildPlacement static

public static void SetQuickAccessChildPlacement(DependencyObject obj, QuickAccessToolbarChildPlacementTarget value)

Sets where an item of the toolbar is meant to appear: on the bar, in the menu, or both.

Parameters
obj
The item.
value
The placement.
Remarks

The built-in toolbar does not read it.

Fields

FooterContentProperty static

public static readonly DependencyProperty FooterContentProperty

Identifies the FooterContent dependency property.

FooterDataTemplateProperty static

public static readonly DependencyProperty FooterDataTemplateProperty

Identifies the FooterDataTemplate dependency property.

HasContentOverflowItemsProperty static

public static readonly DependencyProperty HasContentOverflowItemsProperty

Identifies the HasContentOverflowItems dependency property.

HasItemsProperty static

public static readonly DependencyProperty HasItemsProperty

Identifies the HasItems dependency property.

HeaderContentProperty static

public static readonly DependencyProperty HeaderContentProperty

Identifies the HeaderContent dependency property.

HeaderDataTemplateProperty static

public static readonly DependencyProperty HeaderDataTemplateProperty

Identifies the HeaderDataTemplate dependency property.

IsContentOverflowWindowShowingProperty static

public static readonly DependencyProperty IsContentOverflowWindowShowingProperty

Identifies the IsContentOverflowWindowShowing dependency property.

IsOpenProperty static

public static readonly DependencyProperty IsOpenProperty

Identifies the IsOpen dependency property.

ItemsTemplateProperty static

public static readonly DependencyProperty ItemsTemplateProperty

Identifies the ItemsTemplate dependency property.

QuickAccessChildPlacementProperty static

public static readonly DependencyProperty QuickAccessChildPlacementProperty

Identifies the QuickAccessChildPlacement attached property.

ToolBarPlacementLocationProperty static

public static readonly DependencyProperty ToolBarPlacementLocationProperty

Identifies the ToolBarPlacementLocation dependency property.