-
Notifications
You must be signed in to change notification settings - Fork 706
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
Question: How to do lightweight-styling per style? #4825
Comments
Style does not have a Resources property. If you are a control author that wants to use the light weight style model for the controls in your library the method to do this is to have your control templates reference well known resources by name using {StaticResource} or {ThemeResource} and then publish the default value for those resources along with your styles. If you are an app author you can interact with the winui2 light weight styling by providing overrides to the well known named resources our templates use. We recommend you do this in your application.Resources within the merged dictionaries of your XamlControlsResources. <Application.Resources> |
I am an app author, I want to override the well known named resources at Style level, not app level or control level. I need ButtonStyle1, ButtonStyle2, ButtonStyle3 with different overrides. How to do that? |
Can you use |
but how to override Brushs(ButtonBackgroundPointerOver ...) per Style(ButtonStyl1, ButtonStyl2 ...)? |
I don't think you can per Style. You would have to override the style in a page or panel's resources. |
I think it is not flexible so I ask for help here, I thought there is a better way. |
I'm afraid there isn't much you can do or this. Styles don't allow overriding the Resources property so you would have to override the resources on every control. |
Having said that, Style.Resources sounds like it could be a useful feature for "bundling" up all the light-weight styles associated with a control and it's template. |
Yes there should be an there already is a proposal/discussion for this: #3939 |
I do remember this being proposed, and I did comment on the proposal - but I didn't connect the two weirdly. |
Yes, today the resource system does not have a notion of resources associated with a style. I do think this could be a valuable addition to the system though. |
https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/xaml-styles#lightweight-styling
![image](https://user-images.githubusercontent.com/12285582/114824840-02d69680-9df8-11eb-9ddb-43f42866c751.png)
The text was updated successfully, but these errors were encountered: