
Is it possible to include styles only for specific controls?
Is it possible to include styles only for specific controls?
Hi Magnus,
Can you provide some more information on your question, such as which controls you only want styles for and why? Thank you, that will help us better understand the context of the question.
If you mean that you wish to prevent us from theming native Avalonia controls, you can follow the directions in this documentation topic.
Consider a scenario where FluentAvalonia (or any other theme) and ModernTheme are used together. ModernTheme is added first and FluentAvalonia second. This makes FluentAvalonia override all the default native control themes. I can use all the fundamental controls from ModernTheme with the correct style but what if I'd like to style a specific native Button using a the control theme from ModernTheme. How would I achieve that?
If you wanted to include a ControlTheme for a specific control, like a Button, you could add a ControlTheme whose key is the control type, targets the same type, and is BasedOn one of our predefined ControlThemes. Our "actipro:ControlTheme" markup extension helps find those.
For example:
<ControlTheme x:Key="{x:Type Button}" TargetType="Button"
BasedOn="{actipro:ControlTheme ButtonOutline}">
Please log in to a validated account to post comments.