Hi Niels van Strien
Thank you for contacting Syncfusion Support.
Query : How do I create a button with a Primary button style in xaml?
In our ThemeStudio, by default there is no default support of PrimaryButtonStyle for ButtonAdv controls. But however, you can apply Primary Button style for ButtonAdv by referring the particular PrimaryButtonStyle in application by using the following syntax and change the TargetType as ButtonAdv from Button.
Syntax:[App.xaml]
<Application.Resources>
<ResourceDictionary>
<!--Referring the Primary Button style for application-->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="PrimaryButton.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
|
PrimaryButton.xaml
<!--Changing the target type from Button to ButtonAdv-->
<Style x:Key="WPFPrimaryButtonStyle" TargetType="{x:Type syncfusion:ButtonAdv}">
<!--Changing the target type from Button to ButtonAdv-->
<ControlTemplate TargetType="{x:Type syncfusion:ButtonAdv}">
|
Referred style in ButtonAdv:[MainWindow.xaml]
<syncfusion:ButtonAdv x:Name="buttonAdv" Content="butonadv" Style="{StaticResource WPFPrimaryButtonStyle}" Width="100" Height="23" />
|
Screenshot:
Please try this solution and let us know if it is helpful.
Note: We have prepared the sample for Dark theme, similarly you can prepare for other material themes by referring the respective theme xaml file of PrimaryButton. The theme file can export it in themestudio . For more information, please refer the following UG link:
Regards,
Vijayalakshmi VR