ToolBar.BandIndex
Property
Definition
Gets or sets the band index number that indicates the position of the toolbar on the band.
public int BandIndex { get; set; }
The position of a toolbar on the band of a ToolBarTray.
Examples
The following example shows how use this property to place ToolBar controls inside a ToolBarTray.
<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
If you do not explicitly set this property, its value is determined by the order in which the ToolBar is set in the ToolBarTray. For example, if you put two toolbars in a ToolBarTray without setting the Band and BandIndex properties, the value of Band will be 0 for both toolbars. The value of BandIndex will be 0 for the first toolbar and 1 for the second toolbar.
The position of the ToolBar in a ToolBarTray depends on the values of the ToolBarTray.Orientation, Band, and BandIndex properties. When Orientation is set to Horizontal, a band represents a row in the ToolBarTray. When Orientation is Vertical, a band represents a column of the ToolBarTray. The following table describes the relationship between Orientation, Band, and BandIndex.
| Orientation | Band | BandIndex |
|---|---|---|
| Horizontal | Indicates the row in which the ToolBar is positioned. Toolbars that have Band set to a smaller value are above those with a larger value. | Indicates the position of the ToolBar on the Band. Toolbars that have BandIndex set to a smaller value are to the left of those with a larger value. |
| Vertical | Indicates the column in which the ToolBar is positioned. Toolbars that have Band set to a smaller value are to the left of those with a larger value. | Indicates the position of the ToolBar on the Band. Toolbars that have BandIndex set to a smaller value are above those with a larger value. |
Dependency Property Information
| Identifier field | BandIndexProperty |
Metadata properties set to true |
AffectsParentMeasure |