Export (0) Print
Expand All

ToolBar Class

Provides a container for a group of commands or controls.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[TemplatePartAttribute(Name=L"PART_ToolBarPanel", Type=typeof(ToolBarPanel))] 
[TemplatePartAttribute(Name=L"PART_ToolBarOverflowPanel", Type=typeof(ToolBarOverflowPanel))] 
public ref class ToolBar : public HeaderedItemsControl
/** @attribute TemplatePartAttribute(Name="PART_ToolBarPanel", Type=System.Windows.Controls.Primitives.ToolBarPanel) */ 
/** @attribute TemplatePartAttribute(Name="PART_ToolBarOverflowPanel", Type=System.Windows.Controls.Primitives.ToolBarOverflowPanel) */ 
public class ToolBar extends HeaderedItemsControl
TemplatePartAttribute(Name="PART_ToolBarPanel", Type=System.Windows.Controls.Primitives.ToolBarPanel) 
TemplatePartAttribute(Name="PART_ToolBarOverflowPanel", Type=System.Windows.Controls.Primitives.ToolBarOverflowPanel) 
public class ToolBar extends HeaderedItemsControl
<ToolBar>
  Items
</ToolBar>

ToolBar controls provide an overflow mechanism that places items that do not fit on the ToolBar into an overflow area. Only toolbar elements within a parent ToolBarTray can be moved or resized by the user.

Content Model: A ToolBar is a HeaderedItemsControl. For more information on the content model for ToolBar, see HeaderedItemsControl Content Model.

The following example shows how to create a ToolBar inside a ToolBarTray.

<ToolBarTray Background="White">
    <ToolBar Band="1" BandIndex="1">
        <Button><Image Source="toolbargraphics\new.bmp" /></Button>
        <Button><Image Source="toolbargraphics\open.bmp" /></Button>
        <Button><Image Source="toolbargraphics\save.bmp" /></Button>
        <Separator/>
        <Button><Image Source="toolbargraphics\cut.bmp" /></Button>
        <Button><Image Source="toolbargraphics\copy.bmp" /></Button>
        <Button><Image Source="toolbargraphics\paste.bmp" /></Button>
        <Separator/>
        <Button><Image Source="toolbargraphics\print.bmp" /></Button>
        <Button><Image Source="toolbargraphics\preview.bmp" /></Button>
   </ToolBar>
</ToolBarTray>

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.Media.Visual
         System.Windows.UIElement
           System.Windows.FrameworkElement
             System.Windows.Controls.Control
               System.Windows.Controls.ItemsControl
                 System.Windows.Controls.HeaderedItemsControl
                  System.Windows.Controls.ToolBar

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft