In This Article

Context Menus

The Breadcrumb control displays context menus when the overflow button is clicked and when the popup button on the individual items is clicked. These context menus are automatically populated by the Breadcrumb control but can be customized during runtime.

Customizing the Menu

You can completely customize the default ContextMenus or even supply an alternate menu by handling the Breadcrumb.OverflowButtonClick or BreadcrumbItem.NavigateButtonClick events. The Item property of the event arguments is the ContextMenu that will be displayed. Add/update/remove menu items as necessary there.

In addition, there are numerous properties listed below, which allow the look of the context menus to be customized as well.

The menus displayed by the Breadcrumb control are offset from their associated drop-down button for better alignment. This offset varies based on the theme loaded and defaults to values appropriate for ContextMenus using the same theme. Therefore, the Aero theme for the Breadcrumb control assumes that the menus will also be using the Aero theme and adjusts the offset accordingly.

The menu offset can be customized as needed by setting MenuHorizontalOffset or MenuVerticalOffset, either on the Breadcrumb control or the individual BreadcrumbItem controls. Typically, only the horizontal offset should be adjusted.

When defining a custom DataTemplate for MenuItemTemplate or MenuItemExpandedTemplate, a 2-pixel margin should typically be included on the left side. This 2-pixel margin allows the text in the menu to line up with the text of the next BreadcrumbItem, which is more visually appealing. When using the default DataTemplates, the 2-pixel margin is already defined.

Associated Members

The following Breadcrumb members are associated with the context menus:

Member Description
MenuHorizontalOffset Property Gets or sets the horizontal distance between the target origin and the content menu alignment point.
MenuItemContainerExpandedStyle Property Gets or sets the Style that is applied to the MenuItem elements generated for expanded items in context menus.
MenuItemContainerExpandedStyleSelector Property Gets or sets custom logic for choosing a Style that can be applied to MenuItem elements generated for expanded items in context menus.
MenuItemContainerStyle Property Gets or sets the Style that is applied to the MenuItem elements generated for items in context menus.
MenuItemContainerStyleSelector Property Gets or sets custom logic for choosing a Style that can be applied to MenuItem elements generated for items in context menus.
MenuItemExpandedTemplate Property Gets or sets the DataTemplate used to display expanded items in a MenuItem.
MenuItemExpandedTemplateSelector Property Gets or sets the custom logic for choosing a template used to display expanded items in a MenuItem.
MenuItemTemplate Property Gets or sets the DataTemplate used to display items in a MenuItem.
MenuItemTemplateSelector Property Gets or sets the custom logic for choosing a template used to display items in a MenuItem.
MenuVerticalOffset Property Gets or sets the vertical distance between the target origin and the content menu alignment point.
OverflowButtonClick Event Occurs when the overflow button is clicked, allowing for customization of the ContextMenu it will display.

The following BreadcrumbItem members are associated with the context menus:

Member Description
MenuHorizontalOffset Property Gets or sets the horizontal distance between the target origin and the content menu alignment point.
MenuItemContainerExpandedStyle Property Gets or sets the Style that is applied to the MenuItem elements generated for expanded items in context menus.
MenuItemContainerExpandedStyleSelector Property Gets or sets custom logic for choosing a Style that can be applied to MenuItem elements generated for expanded items in context menus.
MenuItemContainerStyle Property Gets or sets the Style that is applied to the MenuItem elements generated for items in context menus.
MenuItemContainerStyleSelector Property Gets or sets custom logic for choosing a Style that can be applied to MenuItem elements generated for items in context menus.
MenuItemExpandedTemplate Property Gets or sets the DataTemplate used to display expanded items in a MenuItem.
MenuItemExpandedTemplateSelector Property Gets or sets the custom logic for choosing a template used to display expanded items in a MenuItem.
MenuItemTemplate Property Gets or sets the DataTemplate used to display items in a MenuItem.
MenuItemTemplateSelector Property Gets or sets the custom logic for choosing a template used to display items in a MenuItem.
MenuVerticalOffset Property Gets or sets the vertical distance between the target origin and the content menu alignment point.
NavigateButtonClick Event Occurs when the navigate button is clicked, allowing for customization of the ContextMenu it will display.