Trying to Use Theme Dictionaries as Static Resources #18429
Unanswered
Elbon-Eastmage
asked this question in
Q&A
Replies: 2 comments
-
StaticResource supports theme dictionaries. But it requires a context. See the code. When you use StaticResource from XAML, it should already respect target object theme, and correctly resolve resources. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Huh. I did put StaticResource in XAML, but it didn't work. I am using CompiledBindings; could that be the problem? Or do I need to explicitly set the Context in the XAML file? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a style file that gets colors from a separate resource dictionary file. This file divides colors into light and dark themes using theme dictionaries.
My program will look at the system theme to determine whether to use the light or dark theme. Thus, I thought that I could use static resources, since the user won't be changing the theme within the program.
However, when I tried that, the program wasn't able to find the specified colors. Dynamic resources, though, didn't give me any trouble.
Do static resources not support theme dictionaries?
Beta Was this translation helpful? Give feedback.
All reactions