Skip to content

Correct way to redraw an application after changing resources. #18400

Answered by morning4coffe-dev
ArtiDi asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ArtiDi,

AFAIK, I didn't test it, this is more of as WinUI question, but to implement theme changes at runtime without requiring a window resize or page reload, you need to handle the resource dictionary updates dynamically and trigger UI invalidation. Update your RD as you did and use Application.Current.Resources.MergedDictionaries.Clear() to ensure that the theme update applies immediately. You can try using FrameworkElement.RequestedTheme = ElementTheme.Default to force all controls to reapply the current theme.

Let me know, if this works/helps. Thank you.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ArtiDi
Comment options

Answer selected by ArtiDi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants