dotixx
dotixx

Reputation: 1500

My style doesn't inherits the mahapps style

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

Answers (1)

Sense
Sense

Reputation: 181

BasedOnneeds 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

Related Questions