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

Urgent ! Themes at runtime

1 Answer 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chitra Krishnan
Top achievements
Rank 1
Chitra Krishnan asked on 20 Nov 2009, 06:30 AM
Hi Team,

Please let me know how to apply telerik themes at runtime.

This is what iam doing:

1. I added in the <UserControl.Resources> the below:

<

 

ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="resourcedic"

 

 

xmlns:telerik="clr-namespace:Telerik.Windows.Controls">

 

 

 

<ResourceDictionary.MergedDictionaries>

 

 

 

<ResourceDictionary

 

 

Source="/Telerik.Windows.Themes.Office_Blue;Component/Themes/Office/Blue/Docking.xaml" />

 

 

 

<ResourceDictionary Source="/Telerik.Windows.Themes.Office_Blue;Component/Themes/Office/Blue/Button.xaml" />

 

 

 

</ResourceDictionary.MergedDictionaries>

 

 

 

</ResourceDictionary>

 

 

 

</UserControl.Resources>

 


2. In .cs file iam doing the below to apply the them to the canvas inside the raddocpane:

ResourceDictionary dic = resourcedic;

if (dic.MergedDictionaries.Count != 0)

{

Uri uri = dic.MergedDictionaries[0].Source;

ImplicitStyleManager.SetResourceDictionaryUri(grdresult, uri);

ImplicitStyleManager.SetApplyMode(grdresult, ImplicitStylesApplyMode.Auto);

ImplicitStyleManager.Apply(grdresult);

 

}


But the themes are not applying.
Please let me know the steps to go about

Regards
Chitra K


1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 20 Nov 2009, 11:27 AM
Hi Chitra Krishnan,

In order to apply  the themes at runtime you have to set

telerik:StyleManager.Theme="{Binding SelectedValue, ElementName=Themes}"
on all controls how you are using. In the snippet above, ElementName is the x:Name of the control used to change the themes. Have a look at the attached sample project and let us know if you have any additional questions.

Regards,
Dimitrina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Chitra Krishnan
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or