Share via


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。

示例

下面的示例演示如何使用此属性在 ToolBarTray 中放置 ToolBar 控件。

<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>

注解

中 的位置ToolBar取决于 、 BandBandIndex 属性的值ToolBarTray.OrientationToolBarTray 当 设置为 HorizontalOrientation,带区表示 中的ToolBarTray一行。 当 为 VerticalOrientation,带区表示 的ToolBarTray列。 下表描述了 、 BandBandIndex之间的关系Orientation

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

依赖项属性信息

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

适用于

另请参阅