--- title: "ToolBar Overview" ms.date: "03/30/2017" helpviewer_keywords: - "controls [WPF], ToolBar" - "ToolBar control [WPF]" ms.assetid: a8edb32c-118d-4f31-b6e6-8899082b504b --- # ToolBar Overview controls are containers for a group of commands or controls which are typically related in their function. A usually contains buttons which invoke commands. ## ToolBar Control The control takes its name from the bar-like arrangement of buttons or other controls into a single row or column. [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] controls provide an overflow mechanism which places any items that do not fit naturally within a size-constrained into a special overflow area. Also, [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] controls are usually used with the related control, which provides special layout behavior as well as support for user-initiated sizing and arranging of toolbars. ## Specifying the Position of ToolBars in a ToolBarTray Use the and properties to position the in the . indicates the position in which the is placed within its parent . indicates the order in which the is placed within its band. The following example shows how use this property to place controls inside a . [!code-xaml[ToolBarExample#2](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolBarExample/CS/Pane1.xaml#2)] ## ToolBars with Overflow Items Often controls contain more items than can fit into the toolbar's size. When this happens, the displays an overflow button. To see the overflow items, a user clicks the overflow button and the items are shown in a pop-up window below the . The following graphic shows a with overflow items: ![Screenshot that shows a toolbar with overflow items.](./media/toolbar-overview/toolbar-overflow-items.png) You can specify when an item on a toolbar is placed on the overflow panel by setting the attached property to , , or . The following example specifies that the last four buttons on the toolbar should always be on the overflow panel. [!code-xaml[ToolBarExample#3](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolBarExample/CS/Pane1.xaml#3)] The uses a and a in its . The is responsible for the layout of the items on the toolbar. The is responsible for the layout of the items that do not fit on the . For an example of a for a , see [ToolBar Styles and Templates](toolbar-styles-and-templates.md). ## See also - - - [Style Controls on a ToolBar](how-to-style-controls-on-a-toolbar.md) - [WPF Controls Gallery Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Getting%20Started/ControlsAndLayout)