I want to use setter to set the default field for all elements in my stack panel, not just buttons, but also text fields and labels.
<StackPanel>
<StackPanel.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="0,10,0,0"/>
</Style>
</StackPanel.Resources>
...
When I try to change the above Button to Controlor FrameworkElement(the derived type of each element), it does not work.
How can I fix this without specifying 2 different elements Stylewith the same content, but different x: Types in TargetType?
source
share