I want to create a style which I can apply to different control types. Something like this:
<ToolBar>
<ToolBar.Resources>
<Style TargetType="Control">
<Setter Property="Margin" Value="1"/>
<Setter Property="Padding" Value="0"/>
</Style>
</ToolBar.Resources>
<ComboBox .../>
<Button .../>
</ToolBar>
And it should apply to the ComboBox
and the Button
. But it doesn't work like I've written it here.
Is this possible somehow? To target only an ancestor of these classes, like Control
? If not, what would be the best way to apply common settings to a bunch of control?