Hi,
I am a bit confused how to use the styles from the Theme Studio correctly. I have created my own theme based on the Windows 11 Light Theme. Under the framework controls point in the Theme Studio I see the “Primary Button”. If I have understood correctly, this is a standard button. How do I get my standard button to become a primary button?
I have registered my theme in App.xaml.cs:
private static void RegisterTheme()
{
const string style = "myThemeLight";
const string skinHelperStr = "Syncfusion.Themes." + style + ".WPF." + style + "SkinHelper, Syncfusion.Themes." + style + ".WPF";
var skinHelperType = Type.GetType(skinHelperStr);
if (skinHelperType == null)
{
return;
}
if (Activator.CreateInstance(skinHelperType) is SkinHelper styleInstance)
{
SfSkinManager.RegisterTheme("myTheme", styleInstance);
SfSkinManager.ApplyStylesOnApplication = true;
}
}
And I added the theme in my window with the following code:
mlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="TestApp.UI.MainWindow"
xmlns:syncfusionSkin="clr-namespace:Syncfusion.SfSkinManager;assembly=Syncfusion.SfSkinManager.WPF"
syncfusionSkin:SfSkinManager.Theme="{syncfusionSkin:SkinManagerExtension ThemeName=myTheme}"
But in the button control I didn't find a way to set the primary button style defined in the theme. What do I miss to use the style?
Kind regards,
Christian
Hi Christian,
We have checked your reported query that "Set Style as PrimaryButton". We suggest setting the Primary Button style key for the Button as shown below,
You can also refer the style key from the below documentation,
WPF Skin Manager | Apply Themes for Syncfusion WPF controls
And, we have attached the sample below. If you are still facing the issue. Please share the modified sample with us. It will be helpful for us to prompt the solution.
Regards,
Sudharsan
Thx a lot!
I had 2 problems in my code:
Hi Christian Deubel,
We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out.
Regards,
Sudharsan