What is the exact difference between ToolBarPanel and ToolBarTray in wpf?
30,322
Here you are
The ToolBar uses a ToolBarPanel and a ToolBarOverflowPanel in its ControlTemplate. The ToolBarPanel is responsible for the layout of the items on the toolbar. The ToolBarOverflowPanel is responsible for the layout of the items that do not fit on the ToolBar. For an example of a ControlTemplate for a ToolBar, see
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>
Related videos on Youtube
Author by
UFO
Updated on September 10, 2020Comments
-
UFO over 3 years
What is the exact difference between
ToolBarPanel
andToolBarTray
inWPF
?-
Admin over 10 yearsDid you read the MSDN documentation? msdn.microsoft.com/en-us/library/ms752063.aspx. Essentially, you can put a ToolBar into a ToolBarTray, whereas a ToolBarPanel is used as a part of the ToolBar control template.
-
Thomas over 8 years@elgonzo that link is now broken. Is there another?
-
Admin over 8 years@Thomas, the document is still there. When visiting the page, notice the "Other versions" link (it is a drop-down box) underneath the heading "This topic is no longer available". Choose one of the older framework versions to see the document (apparently, MS' documentation system screwed up and failed to import this page for the documentation of "newer" .NET versions). Or just follow this link... :)
-