Problem of theme

4 posts, 0 answers
  1. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 15 May 2009 Link to this post

    If I set ApplicationTheme to Vista as below:

            public Page()  
            {  
                StyleManager.ApplicationTheme = ThemeManager.FromName("Vista");  
     
                InitializeComponent();  
            } 

    and set RadPanelBar as below:
            private void UserControl_Loaded(object sender, RoutedEventArgs e)     
            {     
                StyleManager.SetTheme(RadPanelBar1, ThemeManager.FromName("Office_Black"));     
                     
                 RadPanelBar1.Items.Add(new RadPanelBarItem() { Header = "Test" });     
            }    
     

    RadPanelBar 's theme is still Vista.But if I set

    StyleManager.ApplicationTheme = ThemeManager.FromName("Summer");

    and set

    StyleManager.SetTheme(RadPanelBar1, ThemeManager.FromName("Vista");

    RadPanelBar 's theme is Vista.

    Why the first fails ?
  2. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 15 May 2009 Link to this post

    Problem had been solved.

    There is three method to get a theme:

    1. ThemeManager.FromName("Office_Black");
    2. new Office_BlackTheme();
    3. new Theme(new Uri("/Telerik.Windows.Themes.Vista;component/Themes/generic.xaml", UriKind.Relative)));

    Only No.3 can work in my program.

                StyleManager.SetTheme(RadPanelBar1, new Theme(  
                    new Uri("/Telerik.Windows.Themes.Office_Black;component/Themes/generic.xaml", UriKind.Relative)));  
     

    So, please use No.3 method as possible. It seems that only No.3 method support custom theme.
  3. DevCraft banner
  4. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 21 May 2009 Link to this post

    Why there is no official people say something ?
  5. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 25 May 2009 Link to this post

    Hello yjh,

    The proplem is that you wrote StyleManager.ApplicationTheme = ThemeManager.FromName("Vista");  in the page constructor , but you have to write in the Application constructor.

    Greetings,
    Dimitrina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top