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>

備註

如果您未明確設定這個屬性,其值取決於 中 ToolBarTray 設定 的順序 ToolBar 。 例如,如果您在 中放置兩個 ToolBarTray 工具列而不設定 BandBandIndex 屬性,則這兩個工具列的值 Band 都會是 0。 第一個工具列的 值為 BandIndex 0,而第二個工具列的值為 1。

中 的位置 ToolBar 取決於 、 BandBandIndex 屬性的值 ToolBarTray.OrientationToolBarTray 當 設定為 HorizontalOrientation ,帶代表 中的資料 ToolBarTray 列。 當 為 VerticalOrientation ,帶代表 的資料 ToolBarTray 行。 下表描述 、 BandBandIndex 之間的 Orientation 關聯性。

方向 樂隊 BandIndex
水平 指出 放置 的資料列 ToolBar 。 設定 Band 為較小值的工具列高於具有較大值的工具列。 表示 在 上 Band 的位置 ToolBar 。 已 BandIndex 設定為較小值的工具列會位於具有較大值的工具列左邊。
Vertical 指出 放置 的資料行 ToolBar 。 已 Band 設定為較小值的工具列會位於具有較大值的工具列左邊。 表示 在 上 Band 的位置 ToolBar 。 設定 BandIndex 為較小值的工具列高於具有較大值的工具列。

相依性屬性資訊

識別碼欄位 BandIndexProperty
設定為 的中繼資料屬性 true AffectsParentMeasure

適用於

另請參閱