Style Selector for Theme #5490
-
is it possible to define a selector for a specific theme? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is no any build-in selectors for themes, because Avalonia doesn't have proper theming feature yet (it's only possible to swap resource dictionaries and styles). But personally I would create some global class that reads styles from App and check for FluentTheme.Mode, and also subscribes on styles collection changes to recalculate value. To bind it with windows "mixin" can be used - https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/Mixins/PressedMixin.cs. |
Beta Was this translation helpful? Give feedback.
There is no any build-in selectors for themes, because Avalonia doesn't have proper theming feature yet (it's only possible to swap resource dictionaries and styles).
But personally I would create some global class that reads styles from App and check for FluentTheme.Mode, and also subscribes on styles collection changes to recalculate value. To bind it with windows "mixin" can be used - https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/Mixins/PressedMixin.cs.