Get all available themes

Hi there,

I'd like to create a WPF control (probably combobox or radiobuttons) to let the users change theme at runtime.

Let's say I add 3 themes to the project/application. What is the proper way to get all these 3/available themes?


I hope there is a method like SfSkinManager.GetAvailableThemes() or so

Thanks,

Karoly






4 Replies

SN Sudharsan Narayanan Syncfusion Team September 11, 2023 03:36 PM UTC

Hi Karoly,

We have prepared the sample to achieve your requirement to get the current theme name applied in the WPF project. Please find the sample and code snippet below.

Code Snippet:

SfSkinManager.GetTheme(this).ThemeName;


https://help.syncfusion.com/wpf/themes/skin-manager

You can get the theme by button clicking at run time. If we misunderstood the query, please provide more details about the requirement, or modify our sample and revert to us with a reproducible issue or video. So, it will be helpful to prompt the solution on further. 

Regards,
Sudharsan



Attachment: GetThemeName_211c8ced.zip


KA Karoly September 11, 2023 04:21 PM UTC

Hi Sudharsan, thanks for your reply.


I attach a screenshot to clarify my question.


Let's say I published my application with 3 Syncfusion themes.

So how can I get these 3 available themes that the user can choose from?


Should I use Assembly.Load method or so to see whether it is successful or not to decide whether a given Theme is available, or is there any direct support in SfSkinManager for this?


themes.png




SN Sudharsan Narayanan Syncfusion Team September 13, 2023 03:15 AM UTC

Hi Karoly,

In SfSkinManager, we don’t have the support to get the available theme. So, we can get the available theme from the Assembly Load method to define the theme for the user. 

Please let us know if you need any further assistance.

Regards,
Sudharsan



KA Karoly replied to Sudharsan Narayanan September 13, 2023 04:01 PM UTC

Ok, I see. 

Thanks


Loader.
Up arrow icon