Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a toolbarpanel but it doesnt provide property border, borderbrush, etc. Also it doesnt provide property "ControlTemplate" to customize it.
How to change a border of ToolBarPanel?
Posted

1 solution

This manages to put a border around it, but the tool bar panel takes up the whole screen.....

XML
<Border Name="ToolBarPanelBorder" BorderThickness="5" BorderBrush="Black">
                <ToolBarPanel  HorizontalAlignment="Stretch"  Name="toolBarPanel1" VerticalAlignment="Stretch" >
                    <Button Height="25" >Whazzzup!</Button>
                    <Button Height="25" >Whazzzup!</Button>
                    <Button Height="25" >Whazzzup!</Button>
                </ToolBarPanel>
        </Border>



But try using a grid row?
XML
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="40" />
        <RowDefinition Height="273*" />
    </Grid.RowDefinitions>
    <Border Name="ToolBarPanelBorder" BorderThickness="5" BorderBrush="Black">
        <ToolBarPanel Grid.Row="0"   HorizontalAlignment="Stretch"  Name="toolBarPanel1" VerticalAlignment="Stretch" Orientation="Horizontal" Height="27">
                <Button Height="25" >Whazzzup!</Button>
                <Button Height="25" >Whazzzup!</Button>
                <Button Height="25" >Whazzzup!</Button>
            </ToolBarPanel>
    </Border>
</Grid>


Seems to work.

You can also change BG colour as well

XML
<Grid>
      <Grid.RowDefinitions>
          <RowDefinition Height="40" />
          <RowDefinition Height="273*" />
      </Grid.RowDefinitions>
      <Border Name="ToolBarPanelBorder" BorderThickness="5" BorderBrush="Black" Background="Aquamarine">
          <ToolBarPanel Grid.Row="0"   HorizontalAlignment="Stretch"  Name="toolBarPanel1" VerticalAlignment="Stretch" Orientation="Horizontal" Height="27">
                  <Button Height="25" >Whazzzup!</Button>
                  <Button Height="25" >Whazzzup!</Button>
                  <Button Height="25" >Whazzzup!</Button>
              </ToolBarPanel>
      </Border>
  </Grid>
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-May-11 14:44pm    
Correct, my 5.
--SA
Rob Branaghan 13-May-11 4:09am    
Thank you :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900