Answer the question
In order to leave comments, you need to log in
How to combine multiple CSS styles in wpf?
Hello. Is it possible in WPF to combine multiple styles in one element like in CSS classes (class="class1 class2 class3 class4...")? BasedOn is clearly not enough. You need to specify that this button is:
with an image
padded on the outside
padded on the inside
with a red/green border
with bold text
italic text
with anything else
OPTIONAL
How to do this in WPF?
Thank you.
Answer the question
In order to leave comments, you need to log in
In WPF, this is not possible, the reason for this is simple - the Style property is an object and Style is an object. It can only be inherited (BasedOn) from another, and that's it.
You can try to use MultiBinding and in its converter iterate over all styles and add their setters to the collection of setters at the output of the converter. But you need to understand that, firstly, this is a rather thick operation, and it will be called often, and secondly, you need to handle situations where setters conflict.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question