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

Custom Theme HowTo

9 Answers 684 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Inga
Top achievements
Rank 1
Inga asked on 13 Jul 2012, 01:22 PM
Hello,

i'm looking for hours for a working guide to add a custom theme for some controls (for example the scheduler) and using it in my application.
I want to make a new theme based on the metro theme.

The howto's i found arn't working ... for example
http://www.telerik.com/support/kb/wpf/scheduler/how-to-implement-a-new-custom-theme-in-a-few-steps.aspx

And this link is broken
http://www.telerik.com/help/wpf/common-styling-apperance-themes-custom-theme-project-telerik-approach.html

I hope anybody can tell me how it works?

My version is "RadControls for WPF Q2 2012"

I look forward to your answers!

9 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 16 Jul 2012, 08:13 AM
Hi Inga,

 

Actually the referred articles are not valid and in the newer version the procedure of creating custom theme is a bit different.  
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:

namespace MyTheme
{
    [ThemeLocation(ThemeLocation.External)]
    public class MyCustomTheme:Theme
    {
    }
}


2.Please ensure that in AssemblyInfo.cs of MyTheme Class Library the following piece of code is included: 

[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
    //(used if a resource is not found in the page,
    // or application resource dictionaries)
    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
    //(used if a resource is not found in the page,
    // app, or any theme specific resource dictionaries)
)]


3. Add a new Themes folder with the corresponding ResourceDictionaries for RadGridView (located on..\Q1 2012 Official\WPF\Themes\WPF40\Summer):
System.Windows.xaml, Telerik.Windows.Controls.xaml, Telerik.Windows.Controls.Input.xaml, Telerik.Windows.Controls.GridView.xaml.

4.Specify the external namespace and the Key for your theme in all ResourceDictionaries as follows:  

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

5. The last step is to ensure that the ThemeType of all styles refer to our custom theme:  

<Style x:Key="{telerik:ThemeResourceKey ThemeType=external:MyCustomTheme , ElementType=grid:AggregateResultsList}"
        TargetType="grid:AggregateResultsList" BasedOn="{StaticResource AggregateResultsListStyle}"/>


You may find attached sample application which illustrates this approach.
Furthermore I believe that the following forum thread might be useful on that matter as well.  


I look forward to hearing from you!   

Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
David
Top achievements
Rank 1
answered on 17 Dec 2013, 11:14 PM
Hi, I'm mostly a front-end XAML developer and know very little about build and assembly matters.

So, I was wondering if those assembly values are to be taken literally, or are they just example placeholders we should replace with something else? In other words, Do I literally just supply ResourceDictionaryLocation.None
0
Vanya Pavlova
Telerik team
answered on 18 Dec 2013, 08:50 AM
Hi David,



You may check the following thread, where you may find a detailed information on that matter. 


Regards,
Vanya Pavlova
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Dimitar
Top achievements
Rank 1
answered on 12 Aug 2014, 03:02 PM
Hi Vania, can you update the project you attached as a reply to Inga, so that it works with version 2014.2.729.45 of telerik. I am getting build errors.
Thanks
Dimitar
0
Vanya Pavlova
Telerik team
answered on 12 Aug 2014, 03:40 PM
Hi Dimitar,


Thank you for contacting us.

The sample project uses older version of UI for WPF and referencing the dlls from the latest version would not upgrade the project, because the xaml is different. 

As you may know, we support different theming mechanisms - StyleManager and Implicit Styles. 
You could take a look at the following blog post "XAML Theming – Implicit Styles versus StyleManager".

We strongly encourage our customers to use pure implicit styles combined with NoXAML binaries, which are more maintainable. You may also check our online documentation for further reference. 



Regards,
Vanya Pavlova
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Dimitar
Top achievements
Rank 1
answered on 12 Aug 2014, 04:00 PM
Vania,
Thanks for the quick reply, this looks promising... 
Will try it and let you know how it goes..

P.P.
Having spent a couple of hours digging through threads on this forum, I have a suggestion you might want to propose to the team supporting it. It would be great if there was an option to sort your search results by date, so the most recent threads stay on top as they will be most relevant. 

0
Dimitrina
Telerik team
answered on 13 Aug 2014, 08:58 AM
Hello,

Thank you for sharing your feedback.
I logged it at our Telerik 3.0 Feedback Portal where you can follow its progress: http://teampulse.telerik.com:9896/Project/268/Feedback/List/Your%20Items.


Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
JIG
Top achievements
Rank 1
answered on 07 Feb 2018, 11:39 AM
Can you provide me with a small example project on how to create my own theme based on an existing theme (Office2016 fe)?
I like the styling but i would like to modify a lot more of the colors then is possible now
0
Martin
Telerik team
answered on 09 Feb 2018, 09:17 AM
Hello,

I could suggest you to try the Office2016Palette.Palette endpoint that we provide for modifying globally the theme colors. You can also take a look a our Color Theme Generator that has some presets for our themes and also provides the ability to see during runtime the changes you are making.

If neither of these scenarios would fit your needs, the way to customize our controls entirely is to modify the control templates for each control as we do not provide at the moment a more global solution to modifying more deeply the templates besides the palette colors. You can find the styles in their respective resource dictionaries in the Themes.Implicit/WPF40/Office2016/Themes folder in your installation path.

Regards,
Martin
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
General Discussions
Asked by
Inga
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
David
Top achievements
Rank 1
Dimitar
Top achievements
Rank 1
Dimitrina
Telerik team
JIG
Top achievements
Rank 1
Martin
Telerik team
Share this question
or