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

Create custom tehme

1 Answer 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ron klod
Top achievements
Rank 1
ron klod asked on 04 Aug 2010, 07:40 AM
Hi,

1. we are using "RadControls for Silverlight Q3 2009 SP1"
2. we have created a custom theme which is based on your office blue theme
3. we have changed the namespace: your namespace "Telerik.Windows.Themes.Office_Blue" to "Silverlight.CA_R7.Theme" in all the project. everything complies
4. we gave created a custom theme class by the name "CA_R7_Theme.cs" which contains the follwoing code:
namespace Oblicore.SilverlightClientInfrastructure.Telerik_Theme_Declaration
{
    [ThemeLocation(ThemeLocation.BuiltIn)]
    public class CA_R7_Theme : Theme
    {
        public CA_R7_Theme()
        {
            base.Source = new Uri("/Silverlight.CA_R7.Theme;component/themes/Generic.xaml", UriKind.RelativeOrAbsolute);
        }
    }
}

it doesn't work for us
questions:
1. we have added this class to the theme project dll, it is not located on a seprate dll as in yours telerik.windows.controls.dll, can it be located in the same dll as the theme?
2. in your help you say this:
"The Generic.xaml file is located in the Themes folder", where is the generic.xaml should be located?
in your theme projects you have no generic.xaml file
3. what does this mean "component/themes/Generic.xaml" where is your theme/genric.xaml is located how yours theme works?

10x

Ron

1 Answer, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 06 Aug 2010, 10:01 AM
Hi Ron,

Thank you for your inquiries.

The approach which you are trying to employ is using a Built-In Theme. We have an online article which explains it in more detail. Basically the idea behind the built-in custom theme is that you should keep styling for each control in a separate resource dictionary and merge resource dictionaries by location.
 
For example, resource dictionaries for all controls which are part from Telerik.Windows.Controls.dll should be merged in Telerik.Windows.Controls.xaml (note that this is a resource dictionary which contains Merged Resource Dictionaries only).

Or, resource dictionaries for all controls which are part of Telerik.Windows.Controls.Input.dll (like ComboBox, DateTimePicker, etc.) should be merged in Telerik.Windows.Controls.Input.xaml

As described in the article, the Generic.xaml file is non-existent and is only used as a holder, because the word Generic will be replaced with the name of the control assembly once all relevant resource dictionaries have been merged.

Your themes do need to be placed in a Themes folder. The "component/themes/Generic.xaml" path is a regular way of referencing a resource from a different aseembly in Silverlight. For example:

this.Source = new Uri("/CustomTheme;component/Themes/Generic.xaml", UriKind.Relative);

where "CustomTheme" is the name of the assembly containg your custom theme class.

You can also place your custom theme class in the the same assembly with your other work and the theme will apply, but you have to be careful to update all relevant namespaces and references.

I hope this information helps.

Regards,
Dani
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
ron klod
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or