This is a migrated thread and some comments may be shown as answers.

Switching theme of main window at runtime

5 Answers 206 Views
Window
This is a migrated thread and some comments may be shown as answers.
Uwe Zimmermann
Top achievements
Rank 1
Uwe Zimmermann asked on 26 Oct 2014, 06:09 PM
I'm using RadWindow as main window of a wpf application. Switching theme of all other controls at runtime using implicit styling approach works great. But i can't switch theme of main window?!? Is there any way to get this working?

5 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 27 Oct 2014, 11:18 AM
Hi Uwe,

In order to get the Style changing correctly of RadWindow used as MainWindow you would need to merge the following Style each time the theme is switched:
<Style TargetType="local:MainWindow" BasedOn="{StaticResource RadWindowStyle}" />

Or alternately you could set the Style property of the MainWindow the follow way:
Style="{DynamicResource RadWindowStyle}"

This way the MainWindow will be receiving the correct Style once the theme is switched.

Hope this helps.

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Uwe Zimmermann
Top achievements
Rank 1
answered on 27 Oct 2014, 11:49 AM
Hi Kalin,

thanks for your answer.

Your second approach does not work (window will be transparent).

Merging the style (your first approach) i tryed before i started this thread, but eventually i did something wrong. Could you give me some code showing how to merge the style correctly?
0
Kalin
Telerik team
answered on 27 Oct 2014, 01:29 PM
Hi Uwe,

The approach with the DynamicResource should work as well. However I'm attaching a sample project, demonstrating the first approach I suggested you in my previous post.

Hope this helps.

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Uwe Zimmermann
Top achievements
Rank 1
answered on 27 Oct 2014, 05:42 PM
Hi Kalin,

thanks for your sample project. It works like a charm.
0
Kalin
Telerik team
answered on 28 Oct 2014, 09:58 AM
Hi Uwe,

I'm glad it helped. If you have any other questions, let us know.

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Uwe Zimmermann
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Uwe Zimmermann
Top achievements
Rank 1
Share this question
or