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

Override Resource Keys per Dictionary?

3 Answers 213 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 26 Oct 2020, 06:27 PM

Brief description of the issue.  I have several programs which are all plugins to the same parent application.  Because the style dictionary themes are singletons changing them for one changes them for all of the main application including all plugins (all mine plus any other users that may be using it).  Right now I'm doing things like this:

            FluentPalette.Palette.AccentColor = Color.FromRgb(86, 185, 154);
            FluentPalette.Palette.AccentMouseOverColor = Color.FromRgb(108, 108, 108);

This works fine, but it affects anything using the Fluent theme with those colors.  If any of my other plugins want to use different theme colors (spoiler alert, they do) I can't get it to do both.  

That's the issue.  Right now I have it set up to use implicit themes and I merge the theme dictionaries from the theme dll into a common resource dictionary in each plugin and then any override styles that are necessary for each plugin are in that dictionary and that dictionary is merged into any necessary user controls in the plugin.  This effectively gives me one place for each plugin to manage the Telrik stuff and separates them from each other all except the main color overrides show above.

So the question is; is there a way to set these colors only in a specific resource dictionary?  Instead of setting these in code behind like I've shown, can I have a specific dictionary say that when it's merged it that the 'Accent Color' key is green or red or whatever it should be for that dictionary and have it different for another dictionary?

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 29 Oct 2020, 11:41 AM

Hello Stephen,

Thank you very much for the detailed description of your scenario.

I believe you can use the approach demonstrated in the "Change palette settings per control" demo from our SDK Samples Browser. The source code of the demo is also available in our GitHub repository.

Can you please give it a try and let me know if it would work in your particular use case? I will be awaiting your reply.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Stephen
Top achievements
Rank 1
answered on 29 Oct 2020, 03:23 PM
Hm, ok.  Looks a bit more complicated than I had hoped but also looks like it should work so I'll try that and report back.  Thank you.
0
Dilyan Traykov
Telerik team
answered on 30 Oct 2020, 12:01 PM

Hello Stephen,

Please let me know how this goes. I will be awaiting your reply.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Stephen
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Stephen
Top achievements
Rank 1
Share this question
or