Changing Theme at runtime for the Application

I have a small application and would like to change the Theme as per the user, Light or Dark theme. I have the necessary light and dark theme dlls generated from the Themestudio,

How can I achieve this after starting the application via a Combobox? The theme for the entire application should change on the new selection.


3 Replies

MA Manikanda Akash Munisamy Syncfusion Team September 9, 2024 12:19 PM UTC

Hi Senthil Kumar,

We have reviewed your scenario about changing the theme of the application at runtime. You can achieve this by updating SkinManager.ApplicationVisualTheme in the ComboBox.SelectedValueChanged event. This will apply the selected visual theme to all controls and components in the application.

We have created a sample application using SfForm and SfDataGrid (as an example) along with a ComboBox. In this sample, the theme is applied across the entire application based on the selected value. Note that the theme won't apply to ComboBox (as it's a standard MS control). If you want the theme to apply to the ComboBox as well, you can use SfComboBox , which supports theme application.

For your convenience, we have attached both the sample and a screen recording to guide you.

If we have misunderstood your requirements or if you need further assistance, please provide more details about the issue you're facing. This will help us offer a more tailored solution.

We look forward to your response.

Regards,
Manikanda Akash

Attachment: ThemeSwitching_8440e892.zip


SK senthil kumar September 9, 2024 02:04 PM UTC

Dear Mr Manikanda Akash


Thank you for your reply, while its helpful, my question is kind of different. 


I have created my own themes from the Themestudio as dlls. How to use these dlls for an application-wide theming during run time. The help gives code for design time, during the loading of application and I presume the theme is applied initially.


Can we change the color theme after program start and apply a different theme from the dlls?


Looking forward to hearing from you.


Senthil



MA Manikanda Akash Munisamy Syncfusion Team September 10, 2024 12:12 PM UTC

Hi Senthil,

We have reviewed your scenario regarding switching themes exported from WinForms ThemeStudio. It is indeed possible to apply a custom theme across your entire application. To achieve this, load the exported theme assembly into your application and set the desired theme within the ComboBox.SelectedValueChanged event, as shown below:
 
SkinManager.ApplicationVisualTheme = "VioletTheme";

For more detailed guidance on using custom themes in a Windows Forms application, please refer to the following user guide: 

We hope this information is helpful! If you have any further questions or need additional assistance, please feel free to reach out.

Regards,
Manikanda Akash

Loader.
Up arrow icon