Conversation
mattleibow
commented
Jun 12, 2022
Comment on lines
+328
to
+340
| internal static void RefreshThemeResources(this FrameworkElement nativeView) | ||
| { | ||
| var previous = nativeView.RequestedTheme; | ||
|
|
||
| // Workaround for https://github.com/dotnet/maui/issues/7820 | ||
| nativeView.RequestedTheme = nativeView.ActualTheme switch | ||
| { | ||
| ElementTheme.Dark => ElementTheme.Light, | ||
| _ => ElementTheme.Dark | ||
| }; | ||
|
|
||
| nativeView.RequestedTheme = previous; | ||
| } |
Member
Author
There was a problem hiding this comment.
This is the real "fix" here and is basically a workaround with a still-workaround-but-not-totally fix coming in the core Windows App SDK.
This was
linked to
issues
Jun 12, 2022
hartez
approved these changes
Jun 14, 2022
|
It would be really handy to have an easy way to systematically convert resources into (efficient) properties. That way users could customize the control far more dynamically. It would be nice if this were built in or if there were a better/faster way to do it than the workaround. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
This PR is a workaround for the underlying issue that updating a resource that is applied with a
{ThemeResource}does not take affect because it is actually a{StaticResource}in disguise.There is a more real fix coming with https://dev.azure.com/microsoft/OS/_workitems/edit/39897009
But, for now the workaround is to trigger a "theme change" and that applies the new theme resources. The real fix is also going to do this, but without requiring changing properties.
Issues Fixed