Control themes
See original GitHub issueThe current styling system isn’t really suitable for defining controls themes:
- we don’t have a way to properly specify the default theme
- we don’t have a way to completely re-style a control and prevent the current theme selectors from leaking to such re-styled control
So we need a switchable group of styles that can be associated with a control like Style
is associated with one in WPF and basically act like WPF’s style.
<Button>
<Button.ControlTheme>
<ControlTheme BasedOn="{x:StaticResource SomeBaseButtonTheme}">
<Setter Property="Background" "Value"="Red"/>
<Style Selector=":pointerover">
<Setter Property="Background" "Value"="Green"/>
</Style>
</ControlTheme>
</Button.ControlTheme>
</Button>
Such control theme could be switched and manipulated by selectors in our regular CSS-like styles.
A control would announce its default theme by implementing
interface IHaveDefaultControlTheme
{
Style GetDefaultControlTheme();
}
which would be generated by the XAML compiler based on x:DefaultControlThemeFor
in a XAML file in the same assembly:
<ControlTheme x:DefaultControlThemeFor="{x:Type MyControl}">
</ControlTheme>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Theme of the Day: Control
Theme of the Day: Control · Control of Self · Control of Others · Control of Circumstance · Control of Nature · Control...
Read more >CONTROL - Theme and Symbolism
Control is an illusion. We all need to be in control of something. The only thing you can control is your attitude and...
Read more >22: Power and Control - Chaos, Revenge, and Nurturing ...
This episode is part two of the theme “Power and Control.” It covers how this theme can manifest in clients as chaos, revenge, ......
Read more >Story Theme: Definition and Examples for a Controlling Idea
Examples of Controlling Ideas (or Themes) in Story · The Bluest Eye by Toni Morrison (Society) · A Farewell to Arms by Ernest...
Read more >Defining themes for controls
Defining themes for controls. For theming controls, define the new theme entries in the Plug-in_id _ theme_name .ythm file.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Someone has already raised it, and I have already expressed support in this issue. https://github.com/AvaloniaUI/Avalonia/issues/3686
As for which one is better, the shorter the better, the smaller the number of typing characters, the better, and the smaller space in view of the same function, the better.
Work was started on this a while ago on https://github.com/AvaloniaUI/Avalonia/commits/feature/2769-control-themes - just needs to be finished off.