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

Authoring own Theme

3 Answers 162 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris Smith
Top achievements
Rank 1
Chris Smith asked on 06 Aug 2008, 12:28 PM
Dear All

I've just spent a while trying to get a hand-authored theme (basically identical to SimpleTheme, but in my assembly) to work with the grid, but without success.

I can reference the SimpleTheme class in Telerik.Windows.Controls.UI.Simple and my grid reflects this theme, but if I copy the theme into my project (after fixing up namespaces etc.) and setting the Theming.Theme attached property on the grid to point to my derived class of Theme, I end up with a completely blank grid.

I have two ideas as to why this is happening:
- Assemblies containing themes authored by Telerik are signed with a strong name key
- The syntax I am using to set up the ThemeResourceKey that points a particular style at a particular part of the grid is incorrect.  The following example is from Telerik code:

x:Key="{telerik:ThemeResourceKey ThemeType=telerik:SummerTheme, ElementType=grid:GridViewItemsControl}"

and I'm a bit surprised that ThemeType is assigned like this using just a string.  I've done the same, using the namespace of the class I have which is derived from Theme, but without success.

Can you provide us with a step-by-step guide to hand authoring themes for the Grid, or is this currently not possible?

In the meantime, we are going to continue styling the grid without unifying this into a Theme.

Regards

Chris

3 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 07 Aug 2008, 02:33 PM
Hi Chris Smith,

We are working on expanding our documentation, and we will be including a step-by-step guide on creating your own theme pretty soon. For the future we will also provide a special Visual Studio Project Template which will automate the process for creating a new custom theme.

For now I'm attaching a small project with a theme that inherits from Telerik.SimpleTheme. Inside the XAML files for the RadGridView control you will find files named TableView.Templates.xaml and TableView.Styles.xaml for each built-in theme. You can change TableView.Templates.xaml and TableView.Styles.xaml files from the simple project with the theme that you like (which looks most like your theme) and then edit the templates with some minor changes to namespaces.

For now styles, templates and resources are separated in four different files which makes the whole theming mechanism more flexible. As a guidance you will find all visual element's templates in TableView.Templates.xaml. TableView.Styles.xaml contains styles that just refer to the templates in the other file. Of course there some exceptions from the rule for example with the GridViewRow style (there are some triggers in the style not in the template because of the AlternateRow mechanism). You can put shared resources in Resources.xaml. The TableView.xaml file contains the global theme styles and uses the theme-specific resource keys.

Sincerely yours,
Nedyalko Nikolov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Robert
Top achievements
Rank 1
answered on 06 Nov 2008, 04:59 PM
Hi Nedyalko,

Do you have a release date for the step-by-step guide on creating our own custom theme?

thanks,
Robert
0
Atanas
Telerik team
answered on 07 Nov 2008, 01:00 PM
Hi Robert,

As already know, the step-by-step guide on creating a custom theme from scratch is in our schedule, but probably it will be ready for our next official release. Currently you can use the .xaml files from our Simple theme as a starting point for creating your own custom theme.

Thank you for your understanding and patience.

Kind regards,
Atanas
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Chris Smith
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Robert
Top achievements
Rank 1
Atanas
Telerik team
Share this question
or