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

How to Add Themes to UserControlLibrary

8 Answers 296 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 29 Jan 2015, 03:50 PM
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.

8 Answers, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 29 Jan 2015, 10:10 PM
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.
0
Evgenia
Telerik team
answered on 03 Feb 2015, 12:17 PM
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.

 
0
Eric
Top achievements
Rank 1
answered on 06 Feb 2015, 12:06 AM
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. 
0
Evgenia
Telerik team
answered on 06 Feb 2015, 03:12 PM
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.

 
0
Eric
Top achievements
Rank 1
answered on 06 Feb 2015, 03:46 PM
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.
0
Evgenia
Telerik team
answered on 11 Feb 2015, 09:33 AM
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.

 
0
tats-it
Top achievements
Rank 1
answered on 26 Mar 2018, 01:37 PM

Hi!

Is that still the latest and the only possibility to use Telerik UI Controls in class libraries or WPF control libraries to support implicit styles?

0
Sia
Telerik team
answered on 29 Mar 2018, 11:41 AM
Hello,

I am not sure if I understand correctly your scenario. Actually the shown approach in the Modified-WPF-ClassLibrary-ImplicistStyles.zip shows how to merge the telerik resources in the WpfApplication1 without referencing any telerik controls. Please find a modified version of the same project, where there are no such restrictions and let me know whether it is applicable for your application. You have just need to add references to Telerik.Windows.Controls.dll and Telerik.Windows.Themes.Expression_Dark.dll.

If not, please send me your structure and the most important - whether you have or not Application resources, so I can help you further. 

Regards,
Sia
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
General Discussions
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Evgenia
Telerik team
tats-it
Top achievements
Rank 1
Sia
Telerik team
Share this question
or