Creating a new theme based on an existing one

2 posts, 0 answers
  1. Stephen Kennedy
    Stephen Kennedy avatar
    9 posts
    Member since:
    Dec 2009

    Posted 26 Jan 2010 Link to this post


    I am trying to create a new theme based off your existing Windows 7 theme.  I am using SL 4, VS 2010, with Telerik Silverlight Controls 2009 Q3 SP2.

    I have read the following threads:

    Among others, as well as followed the instructions on creating a new theme in both the online and supplied documentation.

    I have tried to use the supplied custom theme in the first url however, after converting the project to SL4 / VS 2010 it does not work, it throws an exception during runtime about not being able to find some references to needed theme assemblies.

    The steps that I have taken are as follows:

    1.  Create a new SL 4 project
    2.  Add references to all the system & Telerik assemblies that the Windows7 theme project references
    3.  Copy all the XAML files from the Windows7 theme into the new project and add them to the project.  (Changing to a Resource build type with a build tool of MSBuild:MarkupCompilePass1, as it is in the Windows7 project)
    4.  Adjust namespaces / assembly names inside the XAML
    5.  Correct a few references to xmlns:telerik="clr-namespace:Telerik.Windows.Controls" to include the assembly "Telerik.Windows.Controls" to stop ReSharper complaining about them
    6.  Create a new class that inherits from the Theme class and loads the source ("/MyProjectName;Component/Themes/Generic.xaml")
    7.  Add a Generic.xaml file inside the Themes folder of my new Theme project that is based off the Generic.xaml file inside the Telerik.Windows.Control library (again adjusting paths / namespaces)
    8.  Assign the theme to the application, or to a control using the steps described in the documentation (that work with the Telerik supplied themes)

    Is there anything that I am missing, or have done incorrectly?  In particular should I:

    - Change the build tool to MSBuild:MarkUpCompilePass1 as it is in your themes loaded with VS2008, but by default resources are compiled using MSBuild:Compile
    - Use the Resource Build Action as it states in your documentation, or use the Page build action as it is set in the solution supplied by Telerik inside the first URL above.
    - Correct the telerik xmlns declaration to include the assemblies, even though the XAML in the affected files does not reference this tag

    In terms of what happens, if I load the theme as an application theme I get a generic XmlParseException with the code AG_E_UNKNOWN_ERROR on the line where the first themed control is declared.  If I assign to an individual control instead of across the entire application I get a COMException HRESULT_E_FAIL which according to the stack trace is when the style manager is trying to assign the theme to the control. 

    I have examined my theme class library and aside from it containing the theme class (As the Windows7 theme class resides in Telerik.Windows.Controls), its own generic.xaml file, and different project names it is no different from the Windows7 theme class library.  This includes an eyeballing analysis using Reflector.

    Do you have any ideas on what it could be?

  2. Dimitrina
    Dimitrina avatar
    442 posts

    Posted 29 Jan 2010 Link to this post

    Hello Stephen Kennedy,

    Unfortunately, there is an issue with the latest themes and you need to remove the following line of code from the MyGeneric.xaml file.

        Source="/Migturbo_Spring;Component/Themes/Telerik.ReportViewer.Silverlight.xaml" />

    You should also replace the following line:

    with this:


    We hope this will help. If not we would kindly ask you to send us a sample project and we will fix it for you.

    Please, accept our apologies for this inconvenience.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top