Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of the WPF ToolBar?

I'm trying to decide whether I should create a simple StackPanel with Buttons on it, or whether I should use the WPF ToolBar class to contain these buttons (I am creating a simple toolbar).

What are the pros and cons to using WPF's built-in ToolBar control?

So far, these are the only advantages I have seen:

  • The ToolBars can collapse when necessary; additional items are available from a context drop down.
  • If the ToolBar is contained within a ToolBarTray, multiple ToolBars can be repositioned relative to each other.

Are the any other benefits to the WPF ToolBar? Neither of these apply to my simple toolbar.

like image 744
Josh G Avatar asked Dec 05 '22 05:12

Josh G


2 Answers

Accessibility might be better with the WPF Toolbar, because it shows itself to Windows UI Automation as a toolbar with toolbar buttons, rather than some random controls. You never know who'll use your software.

like image 126
OregonGhost Avatar answered Dec 11 '22 09:12

OregonGhost


Another very small advantage is that buttons in the ToolBar will be styled correctly, whereas the buttons in the StackPanel will take on their default look. Not insurmountable by any means, but a little annoyance none-the-less.

like image 31
Kent Boogaart Avatar answered Dec 11 '22 08:12

Kent Boogaart