Reputation: 1500
I'm using MahApps to create a Modern UI app. I want to create a style for all the GroupBoxes present in my UserControl. To do that I wrote this code :
<Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource {x:Type GroupBox}}">
<Setter Property="Width" Value="290"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
This is well applied to my groupboxes but visibly it doesn't inherit the style defined by MahApps. I tried to add a x:Key
and explicitly use it like that : <GroupBox Style={StaticResource MyGroupBoxStyle} Header="Directories">
but it doesn't work either.
What am I doing wrong ?
Thanks !
Upvotes: 0
Views: 3006
Reputation: 181
BasedOn
needs a Style as far as I know.
I'm not using MahApps but you could inherit from the style directly:
BasedOn="{StaticResource MetroGroupBox}
.
Upvotes: 4