Skip to content

ToolBar markup reference

ToolBar bands, groups, and items.

Receiver: ToolBarBand.

Method Sets Summary
Group(params ToolBarEntry[] entries) Adds a group holding the given entries.

Receiver: ToolBarGroup.

Method Sets Summary
Host(Element content) Adds an entry hosting an arbitrary element.
Item(Command command) Adds an entry that runs a command.
Item(Command command, object data, IconTemplate icon = null) Adds an entry that runs a command with data as the invocation argument, so several entries can share one command and differ only in the value they pass.
Items(params Element[] elements) Items Adds the given elements as entries, each hosted as it is. For a toolbar built from controls rather than from commands: the elements keep their own content, handlers and bindings, and the band collapses them into its overflow popup like any other entry.
Label(string text) Adds static text annotating the entry beside it.
Menu(string text, Menu menu, IconTemplate icon = null) Adds an entry with no primary action that opens a menu.
Separator() Adds a rule dividing the entries before it from the ones after.
Split(Command command, Menu menu) Adds an entry that runs a command and opens a menu from its chevron.
Toggle(Command command, bool isChecked = false) Adds an entry that stays visibly pressed while its state is on.
Toggle(Command command, object data, IconTemplate icon = null) Adds a toggle entry that runs a command with data as the invocation argument.

Receiver: ToolBarEntry and derived types (where T : ToolBarEntry).

Method Sets Summary
ToolTip(Element value) ToolTip Sets ToolTip. What to show when the pointer rests on this entry. Content, not a policy: when it is left empty the entry builds one from its command according to ItemToolTipMode.
ToolTip(string text) ToolTip Sets what this entry shows when the pointer rests on it, instead of what its command would say.

Receiver: ToolBarHost.

Method Sets Summary
Content(Element value) Content Sets the hosted element.

Receiver: ToolBarItem and derived types (where T : ToolBarItem).

Method Sets Summary
BindCommand(ObservableValue<Command> source) bind Command Binds the command this entry runs.
Command(Command value) Command Sets the command this entry runs.
CommandData(object value) CommandData Sets CommandData. The value the entry hands its command as the invocation argument, or null to let the nearest argument source supply one. Entries that share a command and differ only in this value show their own Text and Icon.
Icon(IconTemplate value) Icon Sets Icon. Icon shown instead of the command’s own, or null to show the command’s.
Presentation(CommandPresentationMode presentation) Presentation Sets how this entry shows its command, overriding the toolbar’s own presentation.
Presentation(CommandPresentationMode? value) Presentation Sets Presentation. How this entry shows its command, or null to follow ItemPresentation.
Text(string value) Text Sets Text. Text shown instead of the command’s own, or null to show the command’s.

Receiver: ToolBarLabelItem.

Method Sets Summary
BindText(ObservableValue<string> source) bind Text Binds the text this label entry shows.
Text(string value) Text Sets the displayed text.

Receiver: ToolBarMenuItem.

Method Sets Summary
BindIcon(ObservableValue<IconTemplate> source) bind Icon Binds the icon this menu entry shows.
BindText(ObservableValue<string> source) bind Text Binds the text this menu entry shows.
DropDownMenu(Menu value) DropDownMenu Sets the menu this entry opens.
Icon(IconTemplate value) Icon Sets the icon shown on the entry.
Text(string value) Text Sets the text shown on the entry.

Receiver: ToolBarSplitItem.

Method Sets Summary
DropDownMenu(Menu value) DropDownMenu Sets the menu the chevron opens.

Receiver: ToolBarToggleItem.

Method Sets Summary
BindIsChecked(ObservableValue<bool> source) bind IsChecked Binds whether this entry reads as on. Two-way: the toolbar writes the entry back when the button it made is pressed, so the bound value follows the user as well as the application.
IsChecked(bool value = true) IsChecked Sets whether the entry reads as on.

Receiver: ToolBar.

Method Sets Summary
Band(params ToolBarGroup[] groups) Adds a band holding the given groups.
Bands(params ToolBarBand[] bands) Bands Sets the bands, top to bottom.
CanReorderGroups(bool value = true) CanReorderGroups Sets CanReorderGroups. Whether groups may be dragged into a different place. This is a capability, not a mode: a press still runs the entry, and only a drag from a group’s grip moves it. On by default, as a toolbar with grips has been since the toolbars this one is modelled on; turn it off for a fixed one and the grips go with it.
ItemPresentation(CommandPresentationMode value) ItemPresentation Sets ItemPresentation. How entries show their commands unless the entry overrides it.
ItemToolTipMode(CommandToolTipMode value) ItemToolTipMode Sets ItemToolTipMode. What the entries build a tooltip from when the entry supplies none. Decided here rather than per entry: a toolbar that says one thing about half its buttons and another about the rest is harder to read than either. Defaults to everything the command can say, because an icon-only entry shows no name at all.
OnGroupsReordered(Action handler) event GroupsReordered Subscribes handler to GroupsReordered. Raised after a drag has moved a group, once Bands holds the new layout.