Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4609198
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:57:10+00:00 2026-05-22T00:57:10+00:00

I have an application set up so that I can adjust its skin at

  • 0

I have an application set up so that I can adjust its skin at run time. I am doing it as follows each time I change the skin:

Uri uri = new Uri("SomeThemeAssembly;component/Themes/StandardTheme.xaml", UriKind.Relative)
Application.Current.Resources.MergedDictionaries.Clear();
ResourceDictionary resource = (ResourceDictionary)Application.LoadComponent(uri);
Application.Current.Resources.MergedDictionaries.Add(resource);

This works fine.

I have also created a custom control with its controltemplate defined in Themes/Generic.xaml using ComponentResourceKeys for the relevant resources, etc

x:Key="{ComponentResourceKey 
TypeInTargetAssembly={x:Type local:MyCustomControl}, 
ResourceId=MyBrush}"

The style of the custom control itself doesnt use a componentresourcekey as I want it to style all instances.

<Style TargetType="{x:Type local:MyCustomControl}">

Again this all works fine and standard controls I have used to compose elements of my custom control are appropriately styled when I change the skin.

However there are a number of custom properties( brushes, widths, etc) on my control that need to be styled to fit in with the skins I am applying.

In examples I have seen using the standard windows themes adding an additional file

Luna.StandardColor.Xaml

for example, to the themes directory of the custom control allows a modified control template to be set and picked up when that particular theme is applied. This won’t work for me, as far as I can tell anyway, as my skins are not themes.

Can something similar be achieved when using ‘skins’ in the manner I have?

Obviously I can add Styles and ControlTemplates to my skin assemblies but this feels wrong especially as there is a standard naming convention across the skin assemblies for resources. So only a single more maintainable style would be required if it could be stored in Themes/StandardTheme.xaml in my custom control’s assembly.

Having tried to read around on this subject I have the impression want I want to do is either impossible or will require loads of extra leg work.

Any thoughts appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:57:11+00:00Added an answer on May 22, 2026 at 12:57 am

    In the CustomControls Themes Directory add a MyNewTheme.xaml file that’s a resource dictionary that has an implicit style set for your control. Then merge that resource dictionary in with your other one as needed. For example:

    Uri uri = new Uri("SomeThemeAssembly;component/Themes/MyNewTheme.xaml", UriKind.Relative)
    Uri controlsUri = new Uri("ControlAssembly;component/Themes/MyNewTheme.xaml", UriKind.Relative)
    Application.Current.Resources.MergedDictionaries.Clear();
    ResourceDictionary resource = (ResourceDictionary)Application.LoadComponent(uri);
    Application.Current.Resources.MergedDictionaries.Add(resource);
    ResourceDictionary resource = (ResourceDictionary)Application.LoadComponent(controlsUri);
    Application.Current.Resources.MergedDictionaries.Add(resource);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Do EMF files have a DPI that can be set? I have an application
In my application I have a custom model binder that I set to the
I have a web application that has one set of files used by 50+
I have set in my mastersite of my asp.net application the following that the
I have a small shell application that embeds Tcl to execute some set of
I have a very large set of permissions in my application that I represent
I have a sample Rails 3.1.1 application that I have set devise up to
I've been trying to set my application up so that I can unit test
I have an application that performs various tasks that can take up to a
I want to build an application that can set up a set amount of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.