2012-02-25 7 views
0

ToolBarTrayに2つのツールバーがあります。それらは1行に収めることができますが、私は各ツールバーを新しい行に入れたいと思います。 どうすればいいですか? MSDN: ToolBar.BandIndex PropertyからToolBarTray内の新しい行のツールバー

<ToolBarTray VerticalAlignment="Top" Margin="0,20,70,0" Height="65"> 
    <ToolBar Height="30" VerticalAlignment="Top" Background="LightGray" > 
     <Label>Name :</Label> 
     <TextBox Width="120"></TextBox> 
     <ComboBox Width="120" Margin="5,0,0,0"> 
      <ComboBoxItem>Item 1</ComboBoxItem> 
      <ComboBoxItem>Item 2</ComboBoxItem> 
      <ComboBoxItem>Item 3</ComboBoxItem> 
     </ComboBox> 
     <Button Height="25" Width="80" Background="White" Margin="5,0,0,0">Search</Button> 
     <Label>This is a first ToolBar</Label> 
     <Button Height="25" Width="80" Background="White" Margin="5,0,0,0" ToolBar.OverflowMode="Always">Look for ..</Button> 
    </ToolBar> 

     <ToolBar Height="30" VerticalAlignment="Top" Background="LightGray"> 
      <Label>Name :</Label> 
      <TextBox Width="120"></TextBox> 
      <ComboBox Width="120" Margin="5,0,0,0"> 
       <ComboBoxItem>Item 1</ComboBoxItem> 
       <ComboBoxItem>Item 2</ComboBoxItem> 
       <ComboBoxItem>Item 3</ComboBoxItem> 
      </ComboBox> 
     </ToolBar> 
    </ToolBarTray> 

答えて

2

ToolBarTrayのツールバーの位置が ToolBarTray.Orientation、バンド、及びBandIndex特性の値に依存します。 OrientationがHorizo​​ntalに設定されている場合、バンドは ToolBarTrayの行を表します。 OrientationがVerticalの場合、バンドはToolBarTrayの列 を表します。この場合

、あなたがVerticalToolBarTray.Orientationプロパティを設定する必要があります:

<ToolBarTray Orientation="Vertical" 
      VerticalAlignment="Top" Margin="0,20,70,0" Height="65"> 
    <etc /> 
</ToolBarTray> 

そして、およそToolBar.BandToolBar.BandIndexプロパティを忘れないでください:あなたが行う場合は

をこのプロパティを明示的に設定しない場合、その値は によってToolBarTrayにToolBarが設定されている順序で決定されます。たとえば、 BandByTrayに2つのツールバーを配置し、Bandwidthプロパティと BandIndexプロパティを設定しない場合、両方のツールバーでBandの値は0になります。 BandIndexの値は、最初のツールバーでは0、2番目のツールバーでは1となります。

関連する問題