-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Use dynamic resources in Expander button theme. #14542
Conversation
I'm not sure why, but the fluent `Expander` theme uses a mix of static and dynamic resources with seemingly no reason to differentiate them? It's not so much a problem for the resources in the default values for `Expander` as these can be overridden with local values, but for the toggle button and trigger styles, it means there's no way to customize these values. Converted all of the `StaticResource`s to `DynamicResource`s.
@grokys The Fluent Theme for Expander started as a copy paste of upstream which also uses static resources several places. https://github.com/microsoft/microsoft-ui-xaml/blob/winui2/main/dev/Expander/Expander.xaml Over time we've converted some of then to dynamic as needed, above what had to change during the initial port. There are a few reasons:
So... the style was following upstream WinUI is basically the explanation here along with specifics noted above. If you aren't concerned with the overhead of using DynamicResource for everything this PR is fine. Keep in mind Fluent theme basically moves everything possible out to a lightweight styling resource so there are a lot of them. Again, some things like thickness really don't change all that much. Finally, I doubt Expander is the only theme ported from WinUI just changing ThemeResource to DynamicResource. I bet StaticResource comes up like this in other control themes. |
You can test this PR using the following package version. |
The reason this came about was that I wanted to create a borderless For the default values of |
I'm not sure why, but the fluent `Expander` theme uses a mix of static and dynamic resources with seemingly no reason to differentiate them? It's not so much a problem for the resources in the default values for `Expander` as these can be overridden with local values, but for the toggle button and trigger styles, it means there's no way to customize these values. Converted all of the `StaticResource`s to `DynamicResource`s.
What does the pull request do?
I'm not sure why, but the fluent
Expander
theme uses a mix of static and dynamic resources with seemingly no reason to differentiate them. It's not so much a problem for the resources in the default values forExpander
as these can be overridden with local values, but for the toggle button and trigger styles, it means there's no way to customize these values.Converted all of the
StaticResource
s toDynamicResource
s.Pinging @robloo who wrote this theme to check whether this change makes sense, or whether the static resources were there for a reason.