I'm using Mahapps for a GUI, however I want to set some attributes different than visual ones such as margins
and verticalAlignment
, so I added this to the UserControl.resources
section
<Style x:Key="{x:Type TextBox}" TargetType="TextBox" BasedOn="{StaticResource ResourceKey={x:Type TextBox}}">
<Setter Property="Margin" Value="2"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
However it overrides all the visual styles attributes of the TextBoxes, how can I just add those attributes without overriding all the visual styles settings?
give the style a key
and use it where you need it
EDIT or put it to the main resource dictionary of user control or window resource without a key
hope that helps