ToolBarTray Class

Definition

Represents the container that handles the layout of a ToolBar.

[System.Windows.Markup.ContentProperty("ToolBars")]
public class ToolBarTray : System.Windows.FrameworkElement, System.Windows.Markup.IAddChild
Inheritance
Attributes
Implements

Inherited Members

System.Object

System.Windows.DependencyObject

System.Windows.FrameworkElement

System.Windows.Media.Visual

System.Windows.Threading.DispatcherObject

System.Windows.UIElement

Examples

The following example shows how to create a ToolBar inside a ToolBarTray. The example uses the BandIndex property to place tool bars inside tool bar trays.

<ToolBarTray Background="White">
  <ToolBar Band="1" BandIndex="1">
    <Button>
      <Image Source="toolbargraphics\cut.bmp" />
    </Button>
    <Button>
      <Image Source="toolbargraphics\copy.bmp" />
    </Button>
    <Button>
      <Image Source="toolbargraphics\paste.bmp" />
    </Button>
  </ToolBar>
  <ToolBar Band="2" BandIndex="1">
    <Button>
      <Image Source="toolbargraphics\undo.bmp" />
    </Button>
    <Button>
      <Image Source="toolbargraphics\redo.bmp" />
    </Button>
  </ToolBar>
  <ToolBar Band="2" BandIndex="2">
    <Button>
      <Image Source="toolbargraphics\paint.bmp" />
    </Button>
    <Button>
      <Image Source="toolbargraphics\spell.bmp" />
    </Button>
    <Separator/>
    <Button>
      <Image Source="toolbargraphics\save.bmp" />
    </Button>
    <Button>
      <Image Source="toolbargraphics\open.bmp" />
    </Button>
  </ToolBar>
</ToolBarTray>

Remarks

A ToolBarTray is responsible for handling placement, sizing, drag-and-drop operations, and rearranging of ToolBar controls. ToolBarTray controls are also responsible for managing the rows (or "bands") in which ToolBar controls appear. A ToolBarTray may be horizontal or vertical and, like a Menu, is often docked at the top of an application window.

Constructors

ToolBarTray()

Initializes a new instance of the ToolBarTray class.

Fields

BackgroundProperty

Identifies the Background dependency property.

IsLockedProperty

Identifies the IsLocked dependency property.

OrientationProperty

Identifies the Orientation dependency property.

Properties

Background

Gets or sets a brush to use for the background color of the ToolBarTray.

IsLocked

Gets or sets a value that indicates whether a ToolBar can be moved inside a ToolBarTray.

LogicalChildren

Gets an enumerator to the logical child elements of a ToolBarTray.

Orientation

Specifies the orientation of a ToolBarTray.

ToolBars

Gets the collection of ToolBar elements in the ToolBarTray.

VisualChildrenCount

Gets the number of children that are currently visible.

Methods

ArrangeOverride(Size)

Called to arrange and size its ToolBar children.

GetIsLocked(DependencyObject)

Reads the value of the IsLocked property from the specified element.

GetVisualChild(Int32)

Gets the index number of the visible child.

MeasureOverride(Size)

Called to remeasure a ToolBarTray.

OnRender(DrawingContext)

Called when a ToolBarTray is displayed to get the Drawing Context (DC) to use to render the ToolBarTray.

SetIsLocked(DependencyObject, Boolean)

Writes the value of the IsLocked property to the specified element.

Explicit Interface Implementations

IAddChild.AddChild(Object)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

IAddChild.AddText(String)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.