microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.36k stars 678 forks source link

Proposal: CommandBar improvements #5357

Open manfromarce opened 3 years ago

manfromarce commented 3 years ago

Proposal: make CommandBar more flexible

Summary

Since AppBar it's been discontinued and it's not consistent with new WinUI look, the only toolbar-like control is the CommandBar. In my opinion it should be more flexible and have features like:

Rationale

Improving CommandBar would allow developers to more easily migrate from WPF to WinUI. For example, I'm trying to achieve a layout similar to this (but with slightly bigger buttons):

toolbar

and it's difficult with the current CommandBar.

Scope

Capability Priority
Allow left alignment Must
Allow for more compact layout Must
Allow to display label only Must
SplitButton and DropDownButton Must
Overflow mode Could
StephenLPeters commented 3 years ago

@manfromarce are you looking for a ribbon style control? https://github.com/microsoft/microsoft-ui-xaml/issues/168

manfromarce commented 3 years ago

No, I'm looking for a toolbar control

mdtauk commented 3 years ago

The new Simplified Office Ribbon, with a CommandBar smooshed together (a techincal term) could become a Toolbar control. That along with #2310 could be a good idea.

Ideally the CommandBar would get support for ButtonGroups, with single select and multi-select behaviours, with support for Text and Combo boxes - and keep the same overflow behaviour - but look more like the CommandBarFlyout (without the flyout)

If these came together, you could have a toolbar like this image

yoshiask commented 3 years ago

I prototyped a super basic control similar to that single select ButtonGroup using a ListView with special styles. As for a multi-select ButtonGroup, can't that be implemented today as a bunch of ToggleButtons with no label?

leoshusar commented 1 year ago

I feel like I'm either lucky or too demanding, because anytime I pick up new framework I run into something missing in the first few hours😅

I needed some icons-only command bar for my app and I was able to abuse CommandBarFlyoutCommandBar for this: image

I also used Closing="MainCommandBar_Closing" which always resets IsOpen = true, because when it's "closed", those separators will stretch to the bottom, but not to the top, so they look not centered: image

Unfortunately I don't see a way to show labels on the right side with the flyout, so this is also not the greatest workaround, but works for me "for now".

When I use CommandBar, I can set the label position to right (works), but then I can either set position to collapsed for individual buttons (button becomes too wide) image or not set the label (icon is not centered): image EDIT: Setting Width to 40 and collapsed label looks like this could work. I tried to make custom style with width 40 but it looks like something gets overwritten and the style breaks. I also tried to create control that inherits from AppBarButton and sets width to 40 but it broke again, so now I am just setting the number 40 as a static resource. image

Plus if there was an option for vertical command bar, it would be even better.