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

Problem of theme

3 Answers 149 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
yjh
Top achievements
Rank 1
yjh asked on 15 May 2009, 08:49 AM

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 ?

3 Answers, 1 is accepted

Sort by
0
yjh
Top achievements
Rank 1
answered on 15 May 2009, 01:36 PM
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.
0
yjh
Top achievements
Rank 1
answered on 22 May 2009, 04:01 AM
Why there is no official people say something ?
0
Dimitrina
Telerik team
answered on 25 May 2009, 01:48 PM
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.
Tags
PanelBar
Asked by
yjh
Top achievements
Rank 1
Answers by
yjh
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or