IconButton
#282
Replies: 1 comment
-
Yeah, we definitely want to support alignment and size. Some folks may just want a Button with just an icon too. Definitely see a lot of folks wanting some simpler solution here to make it easier to be consistent with this across apps. Wonder if we want to support icon sizes like FYI @JustinXinLiu as well for his thoughts. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Settings Expander
Problem Statement
Icon buttons are everywhere across Windows and other OSes. At the moment, it can be pretty painful to create a consistent IconButton that renders the Icon and Content appropriately - resulting in many different implementations and UX inconsistencies.
The challenge however, is that WinUI provides many different Button types:
Button

ToggleButton

DropDownButton

SplitButton


HyperLinkButton

Required XAML to currently do this:
As you can see, this can be quite verbose - not easy to re-use and prone to (layout) issues (like picking the wrong spacing).
Inspiration
Many community developers have worked on their own implementations of this control/pattern.
Proposed Solution
It'd be great to make it easy for developers to consistently add an icon to a specific button type. Ideally, we'd have IconButton, IconToggleButton, etc. controls - but for the sake of maintenance, I'm not sure if it makes sense to introduce new button types for all of these variants?
Alternatively, we could create a new helper control that can be set as the content of a Button type?
Properties that come to mind:
XAML markup:
results in:

An additional benefit, is that you can quickly move this around in anything that takes an object, e.g.:
In a PivotItem.Header:

ComboBoxItem.Content:

Open Questions
API Reference Docs
References
Windows Visual Library
Beta Was this translation helpful? Give feedback.
All reactions