How can we set a theme globally for each windows?

Hello,

My simple project has this hierarchy:

- App.xml (Application)
   - MainWindow.xaml (Starting point)
   - AnotherWindow.xaml (Created from MainWindow.xaml)


I tried to put the following into App.xaml.cs (OnStartup):

SfSkinManager.ApplyStylesOnApplication = true;

Although, whenever I open a new "AnotherWindow.xaml" window, the style is still the default one.

4 Replies

HS Harsh Shah December 7, 2020 06:15 AM UTC



VR Vijayalakshmi Roopkumar Syncfusion Team December 7, 2020 12:01 PM UTC

Hi Alexis,  
  
Thanks for using our Syncfusion products.  
  
We have checked your requirement that you want to apply the theme globally for the controls in all windows maintained in application”. On applying theme to the Mainwindow and setting ApplyStylesOnApplication as true,  the theme will apply to the mainwindow and the controls in it.  In order to apply the theme to the another window,  we need to set theme for the new window explicitly as shown in the below code snippet for applying theme.  
  
  
SfSkinManager.SetTheme(this, new Theme("MaterialDark"));  
  
  
  
Please let us know if you need any further assistance on this.  
  
Regards,  
Vijayalakshmi VR 



AL Alexis December 9, 2020 01:02 AM UTC

Alright, thanks for the answer.

Maybe the documentation could be modified because "Application Wide" feels like the theme will be applied to everything in the application.
From your explanation, it's more "Window wide" as if you create another window, you need to specify again what's the theme.


VR Vijayalakshmi Roopkumar Syncfusion Team December 9, 2020 04:44 PM UTC

Hi Alexis 
 
Thank you for your update. 
 
When the ApplyStylesOnApplication property of SfSkinManager is set as True , the theme would apply for all the windows which has the same controls in an application. However it won’t apply for the windows which has different controls in application. So only we suggest you to set theme in windows level.  
 
Please let us know if you need any further assistance on this. 
 
Regards,
Vijayalakshmi VR
 


Loader.
Up arrow icon