Posted 02 Sep 2011 Link to this post
I have created a RadComboBox to select Theme.
<
telerik:RadComboBox
Width
=
"100"
Height
"30"
Margin
"20,5"
VerticalAlignment
"Bottom"
SelectionChanged
"RadComboBox_SelectionChanged"
>
telerik:RadComboBoxItem
Content
"Expression_Dark"
/>
"Office_Black"
"Office_Blue"
"Office_Silver"
"Summer"
"Transparent"
"Vista"
"Windows7"
</
And my code in MainPage.xaml.cs:
public
MainPage()
{
StyleManager.ApplicationTheme =
new
Windows7Theme();
InitializeComponent();
}
private
MainPage(
int
index)
//overload of Mainpage()
switch
(index)
case
0: StyleManager.ApplicationTheme =
Expression_DarkTheme();
break
;
1: StyleManager.ApplicationTheme =
Office_BlackTheme();
2: StyleManager.ApplicationTheme =
Office_BlueTheme();
3: StyleManager.ApplicationTheme =
Office_SilverTheme();
4: StyleManager.ApplicationTheme =
SummerTheme();
5: StyleManager.ApplicationTheme =
TransparentTheme();
6: StyleManager.ApplicationTheme =
VistaTheme();
7: StyleManager.ApplicationTheme =
void
RadComboBox_SelectionChanged(
object
sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
RadComboBox comboBox = sender
as
RadComboBox;
index = comboBox.SelectedIndex;
this
.RootVisual =
MainPage(index);
But it seems that this could not work right. So, what's wrong with my code? And what's the right way to set theme at runtime? Thanks, any help will be appreciated. Yue
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>