语言

ToolBar.Band 属性

定义

获取或设置一个值,该值指示工具栏应位于 ToolBarTray何处。

public:
 property int Band { int get(); void set(int value); };
public int Band { get; set; }
member this.Band : int with get, set
Public Property Band As Integer

属性值

工具栏放置的带。ToolBarTray 默认值为 0。

示例

以下示例演示如何使用此属性将控件置于 ToolBar 其中 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>

注解

在 a 中的位置ToolBar取决于属性和ToolBarTray属性的值ToolBarTray.OrientationBand。BandIndex 当设置为Orientation时Horizontal,一个带表示行。ToolBarTray 当为时OrientationVertical,带表示列ToolBarTray。 下表描述了Orientation和 BandBandIndex。

方向 乐队 BandIndex
横向 指示放置位置的 ToolBar 行。 已 Band 设置为较小值的工具栏高于具有较大值的工具栏。 指示在 . 上ToolBar的位置Band。 已 BandIndex 设置为较小值的工具栏位于具有较大值的工具栏左侧。
垂直 指示放置位置的 ToolBar 列。 已 Band 设置为较小值的工具栏位于具有较大值的工具栏左侧。 指示在 . 上ToolBar的位置Band。 已 BandIndex 设置为较小值的工具栏高于具有较大值的工具栏。

Dependency 属性信息

项目 价值
标识符字段 BandProperty
元数据属性设置为 true AffectsParentMeasure

适用于

另请参阅