Can I Change entire theme at a runtime, not just ThemeVariant? #17334
-
Can I Replace entire theme, like changing between Material, Fluent and Simple themes? I think I need to clear visual tree, am I right? How can I do that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
IIRC, the ControlCatalog closes and recreates the Window when changing themes from Simple <-> Fluent. Probably applies the theme from code-behind, too. In practice of a well-designed app, changing themes is not as viable as one might think. Each theme is allowed to be opinionated about its control sizes, margins, and padding. eg. Fluent is way more spacious (even on Compact density) than Simple because it was built to be touch-friendly. You must be careful applying any explicit positioning tweaks in your app views in one theme...because it probably won't look the same on all of them. You could create |
Beta Was this translation helpful? Give feedback.
IIRC, the ControlCatalog closes and recreates the Window when changing themes from Simple <-> Fluent. Probably applies the theme from code-behind, too. In practice of a well-designed app, changing themes is not as viable as one might think. Each theme is allowed to be opinionated about its control sizes, margins, and padding. eg. Fluent is way more spacious (even on Compact density) than Simple because it was built to be touch-friendly.
You must be careful applying any explicit positioning tweaks in your app views in one theme...because it probably won't look the same on all of them. You could create
ResourceDictionary
s that you swap that contains app view spacings for each theme per-dict…