简体   繁体   English

wpf 中 ToolBarPanel 和 ToolBarTray 之间的确切区别是什么?

[英]What is the exact difference between ToolBarPanel and ToolBarTray in wpf?

WPF ToolBarPanelToolBarTray之间的确切区别是什么?

Here you are这个给你

The ToolBar uses a ToolBarPanel and a ToolBarOverflowPanel in its ControlTemplate. ToolBar 在其 ControlTemplate 中使用 ToolBarPanel 和 ToolBarOverflowPanel。 The ToolBarPanel is responsible for the layout of the items on the toolbar. ToolBarPanel 负责工具栏上项目的布局。 The ToolBarOverflowPanel is responsible for the layout of the items that do not fit on the ToolBar. ToolBarOverflowPanel 负责不适合 ToolBar 的项目的布局。 For an example of a ControlTemplate for a ToolBar, see有关 ToolBar 的 ControlTemplate 的示例,请参见

https://docs.microsoft.com/en-us/dotnet/desktop/wpf/controls/toolbar-overview?view=netframeworkdesktop-4.8 https://docs.microsoft.com/en-us/dotnet/desktop/wpf/controls/toolbar-overview?view=netframeworkdesktop-4.8

ToolBarPanel Class ToolBarPanel 类

XAML XAML

 <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>
        <Button>
          <Image Source="toolbargraphics\undo.bmp" />
        </Button>
        <Button>
          <Image Source="toolbargraphics\redo.bmp" />
        </Button>
        <Button>
          <Image Source="toolbargraphics\paint.bmp" />
        </Button>
        <Button>
          <Image Source="toolbargraphics\spell.bmp" />
        </Button>
        <Separator/>
        <Button ToolBar.OverflowMode="Always">
          <Image Source="toolbargraphics\save.bmp" />
        </Button>
        <Button ToolBar.OverflowMode="Always">
          <Image Source="toolbargraphics\open.bmp" />
        </Button>
        <Button ToolBar.OverflowMode="Always">
          <Image Source="toolbargraphics\print.bmp" />
        </Button>
        <Button ToolBar.OverflowMode="Always">
          <Image Source="toolbargraphics\preview.bmp" />
        </Button>
      </ToolBar>
    </ToolBarTray>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM