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

Issue in changing theme/skin of Silverlight RAD controls at runtime

3 Answers 180 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shiv
Top achievements
Rank 1
Shiv asked on 11 May 2011, 11:55 AM
Hi,

I am facing issue in applying theme at runtime.
I am able to set the appl;ication theme by the specified code:

public MainPage()
{
     StyleManager.ApplicationTheme = new Office_SilverTheme();
     InitializeComponent();
}

My requirement is to change the application theme at runtime on change of my Theme/Skin Dropdown:

private void cmbThemes_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (cmbThemes != null)
            {
               StyleManager.ApplicationTheme = new VistaTheme();
             }
        }

So, please provide a solution as displaying in the given example:
http://demos.telerik.com/silverlight/themes/

Thanks & Regards,
Shiv.

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 11 May 2011, 12:02 PM
Hi Shiv,

 

Please take a look at the following forum thread.


Kind regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Shiv
Top achievements
Rank 1
answered on 12 May 2011, 07:34 AM
Hi Vanya Pavlova,

Please refer the original question in the thread as I said, that on application load in the MainPage usercontrol constructor by specifying the below code before calling "InitializeComponent()" I am able to change the Theme of the Application (working fine):

public MainPage()
{
 StyleManager.ApplicationTheme = new Office_SilverTheme();
 InitializeComponent();
}

Problem:   As per my requirement I need to reset the theme of the Application on change of my Combo-box as per the selected Theme which is not happening by the below code:

private void cmbThemes_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
        if (cmbThemes != null)
        {
         StyleManager.ApplicationTheme = new VistaTheme(); //This line of code is just for an example to change the theme.
        }
}


Please provide the solution for implementing such schenario.


Thanks,
Shiv
0
Maya
Telerik team
answered on 12 May 2011, 09:29 AM
Hi Shiv,

There are a couple of possibilities to accoplish changing themes at run time. The first one is similar to the one demonstrated in our demos - both for the examples with Localization and modifying the Theme. Its main idea is that the element changing the language/theme is outside the main view - in the examples it is outside the main grid. The ContentPresenter inside is responsible for loading the page with a different theme. The RootVisual in the App.xaml.cs is set to be the SilverlightControl1.
The other possibility is to implement a navigation logic using the Silverlight Navigation Framework. Thus you may "map" to the correct page with its specific theme. 
Further information about setting the Theme may be found in our online documentation. 

Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Shiv
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Shiv
Top achievements
Rank 1
Maya
Telerik team
Share this question
or