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

  • SEARCH
  • Home
  • 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 234465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:11:13+00:00 2026-05-11T20:11:13+00:00

I have an application that allows the user to change color schemes based on

  • 0

I have an application that allows the user to change color schemes based on an external xaml file. When the user clicks on a MenuItem that contains the name of a theme, the following code executes:

MenuItem mi = sender as MenuItem;
string executingDirectory = Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf("\\"));
string path = System.IO.Path.Combine(executingDirectory + "\\Themes", mi.Header.ToString() + ".xaml");

if (File.Exists(path))
{
    using (FileStream fs = new FileStream(path, FileMode.Open))
    {
        ResourceDictionary dic = (ResourceDictionary)XamlReader.Load(fs);
        Resources.MergedDictionaries.Clear();
        Resources.MergedDictionaries.Add(dic);
    }
}

This works for most of the application – all of my resource brushes change – with one exception. I have a subcontrol whose background color is determined by a value binding using a converter. Rather than hard-code the colors into the converter, though, I had the converter use string constants for brush names and then return the color from App.Current.Resources:

Brush ret = Application.Current.Resources[brushToReturn] as Brush;

What seems to be happening here is that Application.Current.Resources isn’t holding the same set of resources as the window. I have tried loading the theme into Application.Current.Resources and reading from that in the converter, but that doesn’t seem to work either. Can anyone tell me what I’m missing here? Is there a way to change, say, Application.Current.Resources and have it affect the opened windows?

Thanks!

  • 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-11T20:11:13+00:00Added an answer on May 11, 2026 at 8:11 pm

    It’s hard to say without seeing all your code, but checking the Resources property does not automatically check merged dictionaries. Also, if you’re merging the theme resources at the Window level then they won’t be at the application level at all. For consistency sake, you’re best off having your converter get a hold of the element it is converting for and using FindResource:

    var frameworkElement = values[0] as FrameworkElement;
    var resource = frameworkElement.FindResource("SomeKey") as Brush;
    

    Using an IMultiValueConverter might be your best option. Alternatively, if that gets too messy, you might look into writing a markup extension that does what you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that allows the user to download a csv. This works
I have a web application that allows a user to search on some criteria,
I have a simple Desktop Facebook application that allows the user to retrieve some
I have a CakePHP application that allows a user to register and post projects.
I have an application that allows users to write their own code in a
I have a rails application that allows searches using longitude and latitude. I have
Let say, I have a web application that allows users to upload images and
I have a bowling web application that allows pretty detailed frame-by-frame information entry. One
I have a requirement to create a simple windows forms application that allows an
We have created a web application, using ASP.NET, that allows users to upload documents

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.