We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Style basedon not working?

Hey together,

so I'm trying to build an application where I'm using some of the ButtonAdv-controls.
As I'm also coding some triggers connected to it, I've to access the style.
However, I can't get the basedon attribute working on this one.

<Style x:Key="SyncButtonAdvMainPage" TargetType="{x:Type syncfusion:ButtonAdv}" BasedOn="{StaticResource MetroButtonAdvStyle}">
     <Setter Property="Margin" Value="2"/>
     <Setter Property="HorizontalContentAlignment" Value="Left"/>
     <Setter Property="BorderThickness" Value="0"/>
     <Setter Property="SizeMode" Value="Normal"/>
     <Setter Property="IconHeight" Value="30"/>
Gives me an error when using it for a control that the ressource couldn't be resolved.
It works for regular (not Syncfusion) buttons tough as I'm referencing the style and the theme in App.xaml.

          <ResourceDictionary Source="/Syncfusion.Shared.WPF;component/SkinManager/MetroStyle.xaml"/>
       <Style x:Key="MetroButtonBase" TargetType="{x:Type Button}" BasedOn="{StaticResource MetroButtonStyle}">
          <Setter Property="Margin" Value="5" />
Some ideas on this?
Thanks and greetings.

1 Reply

MS Mariappan S Syncfusion Team November 21, 2016 09:46 AM UTC

Hi Marcus 
Thank you for contacting Syncfusion support 
We have checked your updated code. In this you have merged MS control theme resource to our ButtonAdv control. So it doesn’t work for our control. To override ButtonAdv control, the path need to use is 
 “<ResourceDictionary Source="/Syncfusion.Shared.WPF;component/Controls/ButtonControls/Button/Themes/MetroStyle.xaml" />”.  
Please refer below link to get our control resource path. 
We have prepared a sample with ButtonAdv. In this sample, we have override ButtonAdv control style with BasedOn property to use Metro ButtonAdv Style. Please download the sample from the below link. 
Sample link: ButtonAdvSample
Mariappan S.  

Live Chat Icon For mobile
Up arrow icon