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

Custom Theme not working

2 Answers 135 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tony Wright
Top achievements
Rank 1
Tony Wright asked on 28 Jul 2010, 06:13 AM
Hi,

I have copied the Summer theme and renamed all it's tags to suit our project.

Telerik controls are all referenced from within the theme project

All xaml files have their Build Action set to Resource

I have added a theme class, as follows:
using System;
using Telerik.Windows.Controls;
  
namespace Acme.RadControls.Theme
{
    [ThemeLocation(ThemeLocation.BuiltIn)]
    public class AcmeDefaultTheme : Telerik.Windows.Controls.Theme 
    {
        public AcmeDefaultTheme()
        {
            this.Source = new Uri("/Acme.RadControls.Theme;component/themes/Generic.xaml", UriKind.Relative);
        }
    }
}

My understanding of themes is that the BuiltIn attribute overrides the this.Source and the Generic.xaml is ignored.

The theme compiles. Assume I have set the namespace to Acme.RadControls.Theme. This is also the name of the assembly.

The assembly compiles successfully.

In the Silverlight project, I add the following namespace to my page:
xmlns:acmeTheme="clr-namespace:Acme.RadControls.Theme;assembly=Acme.RadControls.Theme"

In the page resources, I add the theme tag:
<navigation:Page.Resources>
  <acmeTheme:AcmeDefaultTheme x:Key="AcmeDefaultTheme" />
</navigation:Page.Resources>

In the radgrid header, I added the stylemanager property, as follows:
<telerik:RadGridView x:Name="grdProducts" ItemsSource="{Binding PagedItemList, Source={StaticResource PFOViewModel}}" IsFilteringAllowed="True" AutoGenerateColumns="False" FrozenColumnCount="6" Grid.Row="4" Grid.Column="0" AutoExpandGroups="True" ShowGroupPanel="False" telerik:StyleManager.Theme="{StaticResource AcmeDefaultTheme}" 
>

The application compiles successfully, and then runs.

When I try to access the page, however, it crashes with the following error:
"A ResourceDictionary '/Acme.RadControls.Theme;component/Themes/Telerik.Windows.Controls.GridView.xaml' cannot be found. Please make sure that references to the needed theme assemblies have been added to the project."

Any ideas what I am doing wrong?

2 Answers, 1 is accepted

Sort by
0
Tony Wright
Top achievements
Rank 1
answered on 28 Jul 2010, 06:29 AM
I should add that the file Telerik.Windows.Controls.GridView.xaml does, in fact, exist at the location \Themes from within the Acme.RadControls.Theme assembly.  I've even opened up the assembly itself using Reflector, and the resources do exist there as well in the Acme.RadControls.Theme.g.resources file.
0
Veselin Vasilev
Telerik team
answered on 03 Aug 2010, 11:14 AM
Hi Tony Wright,

Please find attached a sample project.

Hope it will get you started.

Kind regards,
Veskoni
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
Tony Wright
Top achievements
Rank 1
Answers by
Tony Wright
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or