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

4 posts, 0 answers
  1. Shiv
    Shiv avatar
    8 posts
    Member since:
    Oct 2010

    Posted 11 May 2011 Link to this post

    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.
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 11 May 2011 Link to this post

    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
  3. Shiv
    Shiv avatar
    8 posts
    Member since:
    Oct 2010

    Posted 12 May 2011 Link to this post

    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
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 12 May 2011 Link to this post

    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
Back to Top