5 Answers, 1 is accepted
My understanding is that you want to change the theme of a System.Windows.Controls.Page. Feel free to correct me if that is not the case and provide some more details about your specific scenario.
If that is the case you should be able to achieve this by merging all of the required dictionaries for the theme in the Page's Resources collection instead of doing that in App.xaml.
I hope you find this helpful.
Regards,
Vladimir Stoyanov
Progress Telerik
Hello Vladimir,
Thank you for your reply.
You are correct, if I wanted to change all my pages, so I would use app.xaml and merged dictionaries. When I do so my problem is that the rest of my application's pages' appearance change. And this is what I do not want!
I don't want app.xaml to change the rest of the pages in my program.
I just want my ganttview page to have the windows7 look for example.
How do I do that?
Best Regards
kourosh
I am attaching a sample project which demonstrates how you can merge the needed files in only a certain page of the application. Please take a look at it and let me know if this is what you had in mind. Please note that the approach demonstrated in the attached project assumes that you are using the NoXaml UI for WPF binaries.
If you are using the Xaml dlls, you can set the telerik:StyleManager.Theme attached property on the desired control to the theme that you want. Here is an example:
<telerik:RadButton telerik:StyleManager.Theme=
"Expression_Dark"
/>
Regards,
Vladimir Stoyanov
Progress Telerik
Hello Vladimir,
Thank you so much for your reply. Problem is solved thanks to your guidance sir :)
I have also found another solution in case someone else wanted it:
I put below code in mywindow or user controllers xaml:
<Window.Resources>
<Style
x:Key="TelerikStyle"
TargetType="{x:Type FrameworkElement}">
<Setter Property="telerik:StyleManager.Theme" Value="{x:Static telerik:StyleManager.ApplicationTheme}" />
</Style>
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type Button}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type CheckBox}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type ListBox}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type PasswordBox}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type RadioButton}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type RepeatButton}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type ScrollViewer}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type TextBox}" />
<Style
BasedOn="{StaticResource TelerikStyle}"
TargetType="{x:Type ToolTip}" />
</Window.Resources>
and also this line inside of my window/user controllers constructor:
public MyWindow()
{
StyleManager.ApplicationTheme = new Windows8Theme();
InitializeComponent()
}
and it works.
Best Regards
kourosh
Thank you for sharing your solution.
Regards,
Martin Ivanov
Progress Telerik