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: New resources for styling menus consistently #4594

Open ghost opened 3 years ago

ghost commented 3 years ago

Proposal: New resources for styling menus consistently

Summary

I propose adding a couple new common resources to easily set the same padding, margin and item height among various menus.

Rationale

Scope

Capability Priority
New resources are added Must
Existing resources continue working Must
Resources are added to controls as needed Should

Important Notes

Controls can be updated to use these resources. All existing lightweight resources should continue to work.

Where they can be used:

Here is a working example of horizontal and vertical menus using those resources: commandbar

This proposal can solve all inconsistencies in #4383.

Most controls would only need to change explicit values to those resources. Some controls might need very minor changes.

Extra

CommandBar has resources to set an inner margin, which allows the item to be hovered from outside the visual. This would continue to work with this proposal, but it could be extended to the other menus in the future.

Open questions

Additional notes

If this is approved, I'd like to work on this.

StephenLPeters commented 3 years ago

I would love to increase the number of levels we do resource redirection at, however our system doens't really support this very well. When a resource lookup occurs in the framework, the systems starts looking for a resource with the key "foo" when it finds a resource somewhere in the tree that redirects to a different resource named "bar" the systems continues its lookup from the spot that it found "foo". This means that if "bar" was defined ad a narrower scope than we found "foo" at, the system would miss the "bar" declaration. This really prevents us from having a robust resourcing story, like what you suggesting would help us with. However it is much more performant.

StephenLPeters commented 3 years ago

So this proposal is dependent on https://github.com/microsoft/microsoft-ui-xaml/issues/2913