How to assign a style to all objects at once in WPF

1

Is it possible to create a style in WPF where it will be used for all components of the same type, so it is not necessary to call the Style for the component?

My idea is to create a style such as

 <Style TargetType="Button">

 </Style>

And all the buttons that do not have any style associated with them load the style of that place, without it being necessary to indicate the style key for the button.

As with css, I refer to a style for "p" and all "p's" get that style.

    
asked by anonymous 11.08.2017 / 20:43

1 answer

0

Global styles in WPF can be done as follows:

<Style TargetType="{x:Type TextBox}">
...
</Style>

This would apply to everyone who is of type TextBox or who inherits from TextBox .

To leave this global style, place the style within ResourceDictionary in App.xaml.

    
11.08.2017 / 20:50