How to Add Themes to UserControlLibrary

7 posts, 0 answers
  1. Eric
    Eric avatar
    36 posts
    Member since:
    Apr 2013

    Posted 29 Jan 2015 Link to this post

    I would like to add implicit styles to a UserControlLibrary, how would this be done? The Visual Studio Tools take care of this automatically if it's a wpf application but not for a UserControlLibrary.
  2. Eric
    Eric avatar
    36 posts
    Member since:
    Apr 2013

    Posted 29 Jan 2015 in reply to Eric Link to this post

    turns out that visual studio complains about this, in particular when you used "basedon" one of the telerik styles that it can't find in the user control. 

    That said, even though it complains it builds and finds the style at runtime so this is a minor annoyance.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 03 Feb 2015 Link to this post

    Hi Eric,

     By default the framework requires your applications to reference the Telerik assemblies (all NoXAML binaries and themes that you will use) and because you have decided to go no-xaml, you need to include the xaml resources - the style files that reside in Themes.Implicit folder of our controls local installation path (you will find more information on our implicit styles theming mechanism in our documentation).

    I have used an approach similar to this one to embed the Telerik assemblies in the control library. You will find a project attached demonstrating this. It includes adding the assemblies as embedded resources, a static TelerikThemeUtilities class and some AssemblyResolve work. This pretty much takes care of embedding the assemblies in the class library.

    P.S. The sample project demonstrates how to use our RadChartView control and switch between Windows8 and ExpressionDark themes runtime. Feel free to modify it per your own scenario needs.

    Regards,
    Evgenia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Eric
    Eric avatar
    36 posts
    Member since:
    Apr 2013

    Posted 05 Feb 2015 Link to this post

    I already have the references in the library, do I need to add them to the lib folder too? It seems like it would be simpler if I could just add the xaml files to the library. 

    The solution you sent me can't find any of the telerik references. 
  6. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 06 Feb 2015 Link to this post

    Hello Eric,

    I didn't send the assemblies with the attachment on purpose as this is a forum thread and we do not want our official binaries to be public.
    There is no need to add reference to our binaries in the project as soon as they are referenced in the Class Library and the latter is referenced in the project.

    Regards,
    Evgenia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Eric
    Eric avatar
    36 posts
    Member since:
    Apr 2013

    Posted 06 Feb 2015 in reply to Evgenia Link to this post

    hmmm, I'm sorry, the project you sent me just isn't doing the trick. I can see where the binaries are but I can't run the project and I have no clue how you set that up.
  8. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 11 Feb 2015 Link to this post

    Hello Eric,

    I apologize for omitting to mention some important details on the project previously sent. The AssemblyResolve method in TelerikThemeUtilities class requires the Telerik binaries to be located in lib folder and the binaries there to have Build Action set to EmbeddedResource. Also in the class library you should add reference to the binaries from the lib folder.
    Another thing that was missing is the TelerikThemeUtilities class Initialize method. I attached a modified version of the project previously sent with Trial binaries included from our latest official release Q3 2014. I believe that rebuilding the Class Library is the onliest thing that you should do to run it successfully. Please give it a try and let me know how it works on your side.

    Regards,
    Evgenia
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready