Can you define multiple TargetTypes for one XAML style?

前端 未结 5 1668
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 07:10

In HTML/CSS you can define a style which can be applied to many types of elements, e.g.:

.highlight {
    color:red;
}

can be applied to bo

5条回答
  •  忘掉有多难
    2020-12-01 07:33

    
    
    
    
    
    

    I think both of these methods of declaring a style might answer your question. In the first one, there is no TargetType specified, but the property names are prefixed with 'Label'. In the second one, the style is created for Label objects.

    Another method to do it is: