-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add key names to default control styles #1300
Conversation
<Style TargetType="Button"> | ||
<Style TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}" /> | ||
|
||
<Style x:Key="DefaultButtonStyle" TargetType="Button"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaiguo quick question, would apps that consume WinUI be able to create styles based on these styles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the idea! If you want to give it a spin you can try the nupkg from the PR build. Try this link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, apps consuming WinUI should be able to use these styles. The link Jevan posted above has the latest changes, you can give that a try : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried it and indeed it works! Thanks.
Will there be a docs page or something that lists all the style key names so that we know what key name to put in the BasedOn
style property when creating our own styles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried it and indeed it works! Thanks.
Will there be a docs page or something that lists all the style key names so that we know what key name to put in the
BasedOn
style property when creating our own styles?
As well as docs, will the Design Time experience allow creating copies of all templates in VS or Blend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As well as docs, will the Design Time experience allow creating copies of all templates in VS or Blend?
Yes, you should be able to right click the control on design surface and do "Edit Template -> Edit a Copy"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jevansaks who should we ping for doc updates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just make the changes, but @kikisaints @chigy should recommend which doc we would add it to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My hunch is that it would go here: controls and patterns - buttons under the examples page as a caveat or additional example on how to extend our button control.
Might also be good to mention some of the other styles available for button in generic.xaml, like ButtonRevealStyle..
@chigy for thoughts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kikisaints , are these limited to button? Looks like they could be any control style to BasedOn?
Co-Authored-By: Chris Glein <[email protected]>
Co-Authored-By: Chris Glein <[email protected]>
<SolidColorBrush x:Key="FlipViewButtonPointerOverForegroundThemeBrush" Color="#FF000000" /> | ||
<SolidColorBrush x:Key="FlipViewButtonPressedBackgroundThemeBrush" Color="#BD292929" /> | ||
<SolidColorBrush x:Key="FlipViewButtonPressedBorderThemeBrush" Color="#BD292929" /> | ||
<SolidColorBrush x:Key="FlipViewButtonPressedForegroundThemeBrush" Color="#FFFFFFFF" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these brushes using hardcoded values, instead of reusable resources?
<SolidColorBrush x:Key="FlipViewButtonBackgroundThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="FlipViewButtonBorderThemeBrush" Color="#59D5D5D5" />
<SolidColorBrush x:Key="FlipViewButtonForegroundThemeBrush" Color="#99000000" />
<SolidColorBrush x:Key="FlipViewButtonPointerOverBackgroundThemeBrush" Color="#F0D7D7D7" />
<SolidColorBrush x:Key="FlipViewButtonPointerOverBorderThemeBrush" Color="#9EC1C1C1" />
<SolidColorBrush x:Key="FlipViewButtonPointerOverForegroundThemeBrush" Color="#FF000000" />
<SolidColorBrush x:Key="FlipViewButtonPressedBackgroundThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="FlipViewButtonPressedBorderThemeBrush" Color="#BD292929" />
<SolidColorBrush x:Key="FlipViewButtonPressedForegroundThemeBrush" Color="#FFFFFFFF" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, some of them might not be in the theme colors (There's only ~25 system colors https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/xaml-theme-resources#light-and-dark-theme-colors). I agree we should use the reusable resource if there's one available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've got a separate issue discussing that and that isn't the goal of this change so I don't want to dilute this PR with unrelated changes.
* Add name to default control styles * Fix indentation * Fix test failure * Update dev/Pivot/Pivot_themeresources.xaml Co-Authored-By: Chris Glein <[email protected]> * Update dev/Pivot/Pivot_themeresources.xaml Co-Authored-By: Chris Glein <[email protected]>
🎉 Handy links: |
🎉 Handy links: |
Fixes #1260.
Added key names to default control styles so they can support
BasedOn
styles like below.