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

Custom Theme with only common.xaml

6 Answers 103 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 21 Aug 2012, 08:34 PM
Is there a way to simply use common.xaml to create a custom theme for all Telerik controls?

I'm using build: 2012_2_0725

All I really want to do is take the Office_Black theme and tweak some of the colors. I've already got a theme project setup according the guidelines but copying ALL the xaml files just to change a few basic colors takes an incredible amount of time and makes me worry about applying Telerik upgrades down the road.

6 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 23 Aug 2012, 11:36 AM
Hello Mark,

 


I believe that the best approach here would be to create your own theme based on Office Black. You have to copy the files you need and modify it as described in our documentation. Since you want to change something contained in the template of the control you should modify its XAML. It would be much more appropriate to create your own, rather than to predefine the templates of all controls one by one. Currently the resources in our styles are gathered per assembly, so it would not be so difficult to find desired ones. 
If I can be of further assistance do not hesitate to contact us! 





Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 23 Aug 2012, 01:47 PM
Could you point me in the right direction to get this started. The documentation I found (http://www.telerik.com/help/silverlight/common-styling-apperance-themes-custom-theme-project.html) doesn't quite match with the latest Telerik organization.

An example showing how to change one of the gradient colors used in the RadComboBox would be ideal. For example,  ControlBackground_Normal, ControlBackground_Normal_Stop0..ControlBackground_Normal_Stop3. That's not the only control / colors I'm trying to change but it is one I'm having difficult with at the moment.

0
Vanya Pavlova
Telerik team
answered on 24 Aug 2012, 06:57 AM
Hi Mark,

 

Thank you for getting back to us! 
Please follow these steps when dealing with custom theme in our newest version:

1. Create a new Class LIbrary named MyTheme and add the following piece of code within MyTheme.cs: 

[ThemeLocation(ThemeLocation.BuiltIn)]
   public class MyTheme : Theme
   {
       public MyTheme()
       {
           this.Source = new Uri("/MyTheme;component/themes/Generic.xaml", UriKind.RelativeOrAbsolute);
       }
   }

2. Add a new Themes folder with the corresponding ResourceDictionaries for RadGridView (located on..\Q2 2012 SP1\ Official\Silverlight\Themes\..\Expression_Dark):
System.Windows.xaml, Telerik.Windows.Controls.xaml, Telerik.Windows.Controls.Input.xaml, Telerik.Windows.Controls.GridView.xaml.

3.Specify the namespace for this theme and the Key for your theme in all ResourceDictionaries as follows:   

xmlns:external="clr-namespace:MyTheme"
<local:MyTheme x:Key="Theme" />


You may find attached sample application which illustrates this approach.  
As per your question about RadComboBox you may check the following thread for further reference. 


Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 28 Aug 2012, 01:55 PM
While I can use what you've outlined to stylize a lot of controls, the RadComboBox is still a stickler. The example you provided doesn't really help because it is stylizing ONE control, not all RadComboBoxes. Changing the ControlBackground_Normal and the

 

ControlBackground_Active_Stop0

 

 

..ControlBackground_Active_Stop3 in Telerik.Windows.Controls.xaml does not change the RadComboBox

 

 

I got to a point where I was frustrated with all the XAML I had to copy into my project just to change a couple of colors. I wanted to try another approach so I attempted to modify the Office_Black common.xaml, compile that theme and tell my project to use that theme. Unfortuantely it didn't look like it actually compiled the common.xaml. I think this had something to do with build action of the _x.xamls being set to PreprocessedXaml. Is there some trick I'm missing to modifying the common.xaml of a built-in Telerik theme?

0
Vanya Pavlova
Telerik team
answered on 03 Sep 2012, 07:09 AM
Hello Mark,

 


Rather unfortunately we are not quite sure what might be causing this behavior. Generally if you change a resource used by in control template it will be handled correspondingly. Would it be possible to isolate the problem in a small runnable project and send it back to us as an attachment to a new support thread? 




Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 26 Sep 2012, 07:06 PM
How about you supply with me a simple project that does global theming for the RadComboBox using build 2012_1_0215. You claim that is not difficult but I've encountered nothing but difficulty. The solutions you give me point to documentation I have already read, use overly simplified examples (not RadComboBox), don't match with the build we are using (2012_1_0215) or point to things I already understand (how to use a custom theme).

Our application has several pages with RadComboBox. All we want to do is change the color of those controls in one place, not across dozens of pages. Using Expression Blend is not an option because many of the controls are created in code. 
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Mark
Top achievements
Rank 1
Share this question
or