I've just installed the new RadControls Q1 2009 and tried to change the sample application theme!
I already checked several posts regarding theming but I could not find any answer to my problem.
Example:
http://www.telerik.com/community/forums/silverlight/window/change-theme-of-radwindow.aspx
It seams that something changed on this version!
Could you explain what should I do on this version?
Thanks.
44 Answers, 1 is accepted
We have made some modifications in theming mechanism in this release (Q1 2009).
There are two ways that you can use to change the application theme.
The first way is to use StyleManager.ApplicationTheme property:
StyleManager.ApplicationTheme = ThemeManager.FromName("Vista"); |
With this release we shipped three predefined themes: Vista, Summer and Office_Black (this is the default theme). You can use ThemeManager.FromName method with this three keys. FromName will return Theme object with predefined source property.
The second way is to use directly the Theme class:
Theme cutomTheme = new Theme(new Uri("/MyCustomThemeAssembly;component/Themes/generic.xaml", UriKind.Relative)); |
cutomTheme.IsApplicationTheme = true; |
Using Theme class allows you to specify custom or predefined theme.
Let me know if you need more information.
Greetings,
Hristo
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.
Telerik.Windows.Controls.StyleManager.ApplicationTheme = Telerik.Windows.Controls.ThemeManager.FromName("Vista");
public App() |
{ |
this.Startup += this.Application_Startup; |
this.Exit += this.Application_Exit; |
this.UnhandledException += this.Application_UnhandledException; |
Telerik.Windows.Controls.StyleManager.ApplicationTheme = Telerik.Windows.Controls.ThemeManager.FromName("Vista"); |
InitializeComponent(); |
} |
System.Windows.Markup.XamlParseException occurred
Message="AG_E_RUNTIME_MANAGED_UNKNOWN_ERROR [Line: 145 Position: 44]"
LineNumber=145
LinePosition=44
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at MyApp.Page.InitializeComponent()
at MyApp.Page..ctor()
InnerException:
Thank you for your time,
Ender
Edit: Typo
Most probably you have unchecked "Enable Just My Code (Managed only)" in Visual Studio menu.
Please check it if you don't want to see this error. It is in Tools->Options->Debugging->General->Enable Just My Code (Managed only).
This errors are handled so your application will work.
Sincerely yours,
Hristo
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.
Edit - purchased product opening support
You mention only 3 themes.
What about the others included dll like "Telerik.Windows.Themes.Default_Green.dll" ?
Are they not working?
Thanks
Eric
The theming doesn't work in my project.
The StyleManager is set to "Vista".
But when I add later dynamically a new panel with a RadChart inside, it is using the default theme (Black).
Why it doesn't use "Vista" ?
Eric
Only the Vista, Summer and the default Office_Black themes are provided. The other do not contain Styles for all of our controls (and in fact they contain color schemes for Summer theme so they should be actually called Summer_Red, Summer_Green, etc...).
What are you using: StyleManager.Theme="Vista" or the static property StyleManager.ApplicationTheme?
The first one set theme only to the control that you attach it.
The second one change the global (application) theme so RadChart should be with the Vista theme.
If you are using the second one can you send us a sample project demonstrating your scenario?
Thanks.
Regards,
Hristo
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.
Hi Hristo,
I'm using:
public App() |
{ |
this.Startup += this.Application_Startup; |
this.Exit += this.Application_Exit; |
this.UnhandledException += this.Application_UnhandledException; |
StyleManager.ApplicationTheme = ThemeManager.FromName("Vista"); |
InitializeComponent(); |
} |
So I try to prepare a sample project.
Thanks
Eric
Thanks
Eric
where can I find the Summer-Theme, you wrote about?
Or did you mean the "default_"-Themes?
Simon
I have the same issue.
I've never been able to get different themes to show based on multiple examples from telerik videos & web pages.
Futures didn't work, and now Q1 2009 doesn't work.
StyleManager.ApplicationTheme = ThemeManager.FromName("Vista");
didn't work
Theme cutomTheme = new Theme(new Uri("/Telerik.Windows.Themes.Default_Red;component/Themes/generic.xaml", UriKind.Relative));
cutomTheme.IsApplicationTheme = true;
didn't work
<Grid.Resources>
<telerik:Theme Source="/Telerik.Windows.Themes.Vista;component/themes/generic.xaml" x:Key="theme"></telerik:Theme>
</Grid.Resources>
didn't work
One of these days I'm going to be blown away just by seeing it actually work for the first time.
Can you send us sample project demonstrating the problem you have.
To apply Vista theme you have to add reference to Telerik.Windows.Themes.Vista assembly.
Then in the Application constructor (before InitializeComponents method) set StyleManager.ApplicationTheme property like this:
StyleManager.ApplicationTheme = ThemeManager.FromName("Vista"); |
That's it. This works for Silverlight and WPF.
All the best,
Hristo
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.
I am getting the AG_E_RUNTIME_MANAGED_UNKNOWN_ERROR [Line: 54 Position: 56]
Even I am not using the Theme. I have set the same thing u have mentioned in the Tool->Option ....
Still no luck.
This error is really disturbing me. Please help me out its urgent.
Could you send us project where this error happens?
Without project there is little we can do.
Sincerely yours,
Hristo
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.
Not able to get your exmaple to work with a custom theme for Q1 2009
Theme cutomTheme = new Theme(new Uri("/MyCustomThemeAssembly;component/Themes/generic.xaml", UriKind.Relative)); |
cutomTheme.IsApplicationTheme = true; |
All I did was take the Office_Black Source and modify the colors from Orange to our site colors of Green compiled it and renamed it to Telerik.Windows.Themes.CustomTheme. Then referenced this in the SL. Also I noticed the the Office_Black theme does not have a generic.xaml but rather an Generil_SL.xaml. So here is what my version looked like, please tell me what step I left out.
Theme cutomTheme = new Theme(new Uri("/Telerik.Windows.Themes.CustomTheme;component/Themes/Generic_SL.xaml", UriKind.Relative)); |
cutomTheme.IsApplicationTheme = true; |
thanks for the help to get this working...
You need to set the skin via code.
this.radChart1.Skin = "Vista"; |
Eric
Here is the link to a zip file which is my entire project.
Theme Test Project
It is just a simple RadSilverlight Menu (I was following one of your training videos).
I cannot get the menu's theme to change no matter what theme I throw at it.
Right now, the theme changing code is commented out in App.xaml.cs
I appreciate if you can take a look and let me know what I'm doing wrong.
(It would also be great if you can find out why I cannot get the menu to show in the upper left corner of the browser. Our company uses IE6 internally)
Thanks,
Ray
Hi Sir,
You are unable to change the themes because the WebApplication is not connected with the silverlight application thus changes made in silverlight will not reflect in the web app (no one will copy the xap file from silverlight to web ClientBin directory).
To link both project you should right click on the web project -> Property pages -> Silverlight Application.
Then hit Add button and choose Silverlight project (from the dropdown) and click Add button. This way you will connect the web application with the silverlight application and all xap file will be copied to the web application ClientBin directory.
After that go to App.xaml.cs and uncomment the StyleManager line. And you will have vista theme.
One recommendation: remove the unused assemblies like: Telerik.Windows.QuickStart and all Default_* Themes assemblies (they do not include styles for all controls).
About not being able place RadPane in top left - the reason is that RadFrameContainer is actually a Grid panel. Grid panel have by default HorizontalAlignment and VerticalAlignment set to Stretch and is taking all available space. Then your pages (RadPage) has some Width set and this width is smaller then the Grid actual width. So the grid centers the pages. If you want to put them at top left position just set HorizontalAlignment="Left" and VerticalAlignment="Top" on every page.
One small note: the ScriptManager is taking some place at the top. Surround it with div element like this to remove the space reserved for it:
<div style="margin:0; padding:0"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableHistory="true"> |
</asp:ScriptManager> |
</div> |
Let me know if you need more information.
Regards,
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
That is so awesome, thank you!
I did all your suggestions and everything is perfect.
Again, thanks for your time, patience, & tips.
Ray
I'm having a similar issue.
I can set the vista theme, but I can't set a custom theme (eg. the theme from http://blogs.telerik.com/ValentinStoychev/Posts/08-11-19/Tweaking_the_Theme_colors_for_Telerik_Silverlight_Controls.aspx ).
Setting the theme in xaml results in an error, setting it in code behind doesn't change a thing.
You can download my solution file over here.
Thanks in advance.
Kind regards,
Maarten Thoelen
Also, is there more documentation to be found other than taking guesses at intellisence and http://www.telerik.com/help/silverlight/introduction.html? The videos are useful, but it seems you know something that we don't know everytime I watch them. The tools are great, but the reference material for Silverlight controls really seems to be lacking.
It'd be great to have a list of properties/methods for each control and what they do--in plain English. These tools are probably great if you've been a .NET programmer for a while, but they're really tricky to figure out if you're jumping from another language over to the Microsoft side. More helpful resources would be great.
With the Q1 release we shipped only three themes: Vista, Summer and the default Office_Black.
The Default_* should not be used because they are just color variations of Summer theme and they do not include styles for all of our controls.
One other thing - if you want to use the Office_Black theme you don't need to add reference to the Office_Black assembly because this theme is the default one. Also, setting the Office_Black should be done like this:
<UserControl x:Class="SilverlightApplication31.Page2" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
Width="400" Height="300"> |
<UserControl.Resources> |
<telerik:Theme Source="/Telerik.Windows.Controls;component/Themes/generic.xaml" |
x:Key="officeBlackTheme" /> |
</UserControl.Resources> |
<Grid x:Name="LayoutRoot" Background="White"> |
<RadioButton Content="I have Theme" VerticalAlignment="Center" telerik:StyleManager.Theme="{StaticResource officeBlackTheme}"/> |
<RadioButton Content="NO Theme" VerticalAlignment="Center" Margin="0 35 0 0"/> |
</Grid> |
</UserControl> |
As for the documentation - you are right. We will definitely improve it.
Thank you for your feedback.
Let us know if you need more help.
Best wishes,
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
public App() |
{ |
this.Startup += this.Application_Startup; |
this.Exit += this.Application_Exit; |
this.UnhandledException += this.Application_UnhandledException; |
// Telerik Vista Theme (needs to be set before page is added to the RootVisual) |
// http://www.telerik.com/community/forums/silverlight/general-discussions/apply-themes-on-radcontrols-q1-2009.aspx |
StyleManager.ApplicationTheme = ThemeManager.FromName("Vista"); |
InitializeComponent(); |
} |
If you check Enable Just My Code (Managed Only) in Tools->Options->Debugging you won't see this errors. The cause of this is that our assembly (Telerik.Windows.Themes.Vista) have styles for all controls (e.g. RadWindow, RadDocking, RadEditor, RadSlider). We parse this assembly resources and try to load this types. If the load succeeds then we load (parse) this style. If the load fail then an exception is raised (and this exception is catched - but if you uncheck this option that I mention in the beginning you will still see it) and we don't load this style.
This is needed because we wanted to have single assembly including styles for all RadControls but you may not have references to all needed assemblies.
For the next version we will improve the way of checking if one assembly is loaded (so even if you uncheck enable just my code you won't see exceptions).
I hope this helps. Let me know if you need more information.
Sincerely yours,
Hristo
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Check this help article:
http://www.telerik.com/help/silverlight/applying-theme-to-stanard-controls.html
Sincerely yours,
Valentin.Stoychev
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.
But Source="/Telerik.Windows.Controls;component/Themes/generic.xaml" doesn't indicate the theme name. If I want use Vista theme,how to do it ?
You can set the Vista theme by using one of the following techniques:
1.If you want to set a global theme for the entire application use this:
<UserControl.Resources>
<controls:VistaTheme x:Key="theme" IsApplicationTheme="True"/>
</UserControl.Resources>
Where controls is :
xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
2. If you want to have different themes in one application you can use this:
<telerik:RadToolBar controls:StyleManager.Theme="Vista"/>
or
<UserControl.Resources>
<controls:VistaTheme x:Key="theme" IsApplicationTheme="False"/>
</UserControl.Resources>
<telerik:RadToolBar core:StyleManager.Theme="{StaticResource theme}"/>
3. You can acieve the same functionality in this way too:
<UserControl.Resources>
<core:Theme x:Key="theme" Source="/Telerik.Windows.Themes.Vista;component/Themes/generic.xaml"/>
</UserControl.Resources>
<telerik:RadToolBar core:StyleManager.Theme="{StaticResource theme}"/>
Note: Do not forget to add a reference to the Telerik.Windows.Themes.Vista.dll !
I hope this answers your question.
Best wishes,
Boryana
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.
I would like to try it out on silverlight 3 if your intrim release supports it.
Thanks for your question.
For the upcoming Q2 release we will include two color variations of the Office theme - Office Blue and Office Silver. As the Office Black theme became the default theme with Q1 2009 we are currently focused on making color variations of it. For the next major release Q3, we will be working on a new theme and again we will include color variations of it. As for the Summer theme, we do not plan to support its color variations as we will be mainly focused on the new themes that will be significantly improved. However, you can change the brushes of the Summer theme yourself and we can assist you along the way so that you will achieve the desired results.
Regards,
Nick
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.
Also if you supply me Common.Xaml files for default_* skins then that will be great
As we mentioned in another ticket you opened - we will work on updating the Summer theme's color variations after the official Q2 launch. We cannot send to you an updated XAML of these color variations at this time.
As for the Common.xaml for the default theme - you can use the Generic.xaml file that comes with our installation.
Hope this helps.
Sincerely yours,
Nick
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.
Toshendra
We can't give you an exact estimate - we are now polising our plans for the Q3 release and setting the right priorities. In what colors are you interested in?
Best wishes,
Valentin.Stoychev
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.
What will be nice is if you have the controls where you set property on the control say ThemeColor="#FFA4E566 and all gradient brushes will adjust according to that color ( I guess I am expecting too much).
Thanks for your feedback. I've added 500 Telerik points to your account.
Regards,
Valentin.Stoychev
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.
StyleManager.ApplicationTheme=ThemeManager.FromName('xxxx'); does not update the visual appearance immediately. What is the trick?
You may take a look at the following blog post "Changing Silverlight application themes at runtime".
Vanya Pavlova
the Telerik team
Anything else I need to do?
I have prepared an example similar to the Silverlight's one for you, where the Window's Content is recreated at runtime.
Please let me know how this works for you.
Vanya Pavlova
the Telerik team
I am trying to use commands and the ViewModel approach, not code-behind events. How do I get the handle of the (graphic) object where Reset_Content is actually a method, from with my ViewModel?
Thank you.
The RestContent method simply reloads the content of the parent Window, it is not related to your ViewModel. You may implement your custom routed commands, that will reload the view for each theme in a similar way as it was demonstrated in the previous example.
Vanya Pavlova
the Telerik team