如何在WPF APP中更改ToolBarPanel的边框? [英] How to change a border of ToolBarPanel in WPF APP?

查看:483
本文介绍了如何在WPF APP中更改ToolBarPanel的边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工具栏面板,但是它不提供属性border,borderbrush等.它也不提供属性"ControlTemplate"来对其进行自定义.
如何更改ToolBarPanel的边框?

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?

推荐答案

这设法在边框周围放置边框,但是工具栏面板占据了整个屏幕.....

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

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

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



似乎可以工作.

您还可以更改BG颜色



Seems to work.

You can also change BG colour as well

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


这篇关于如何在WPF APP中更改ToolBarPanel的边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆