語言

ToolBar.BandIndex 屬性

定義

取得或設定指針帶的索引號碼,指示工具列在帶上的位置。

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

屬性值

工具列在 帶 ToolBarTray上的位置。

範例

以下範例說明如何利用此特性在 ToolBarToolBarTray。

<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 中被設定 ToolBarTray的順序決定。 舉例來說,如果你在 a ToolBarTray 裡放兩個工具列但沒有設定 Band 和 BandIndex 屬性,那麼兩個工具列的值 Band 都會是 0。 第一個工具列的值 BandIndex 為 0,第二個工具列為 1。

在 a 中的位置ToolBar取決於 、 ToolBarTray、 及ToolBarTray.Orientation性質的值Band。BandIndex 當 Orientation 設為 Horizontal時,帶狀代表 中的一列 ToolBarTray。 當 Orientation 是 Vertical時,一條帶代表 的 ToolBarTray一欄。 下表描述了 、 Orientation、 與 Band之間的關係BandIndex。

導覽 樂團 樂團索引
水平 表示 該 ToolBar 的位置。 設定 Band 為較小值的工具列高於設定為較大值的工具列。 表示 在 ToolBarBand上的位置。 設定 BandIndex 為較小值的工具列會位於較大值的工具列左側。
垂直 表示 所在 ToolBar 的欄位。 設定 Band 為較小值的工具列會位於較大值的工具列左側。 表示 在 ToolBarBand上的位置。 設定 BandIndex 為較小值的工具列高於設定為較大值的工具列。

相依財產資訊

Item 價值觀
識別碼欄位 BandIndexProperty
元資料屬性設為 true AffectsParentMeasure

適用於

另請參閱