Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

help with migrating wpf control from exectuable to assembly

help with migrating wpf control from exectuable to assembly

help with migrating wpf control from exectuable to assembly

short background: we are migrating from vb6 to c#/wpf. there are pieces we were simply launching via an executable from the vb6 application. the desire now is to move those controls into a library.

this migration is causing a headache when it comes to accessing the resource tree. previously we had resource dictionaries defined in our App.xaml. this worked well and allowed them to trickle down to all controls. and in certain controls where we are building pieces on the fly we were able to call Application.FindResource to get the specific piece we needed. the lack of Application.FindResource is the crux of my current insanity. i have played with a handful of options. the latest of which is:

CODE --> c#

public object GetResourceFromAssembly(string resourceName)
            var assembly = GetType().Assembly;
            string[] resources = assembly.GetManifestResourceNames();
            foreach (string resource in resources)
                    var resourceManager = new ResourceManager(resource, assembly);
                    var res = resourceManager.GetObject(resourceName);
                    if (res != null)
                        return res;
                catch (ArgumentNullException ex)
                catch (MissingManifestResourceException  ex)
                catch (Exception ex)
                    Logger.LogError(ErrorCode.Unexpected_error, "", ex);

            return null;

no matter what i do i seem to hit the MissingManifestResourceException when using resourceManager.GetObject. the particular resource i am trying to get to is my generic.xaml. it is located in a folder in the project called themes and is set to be an embedded resource for its build action. we have a handful of styles specified in generic.xaml. in today's case i am trying to get a brush out of it. this brush property is databound to a wpf button.

in short, what is the best equivalent to Application.FindResource when loading from an assembly resource. oh and the resource is not in a satellite assembly; it is compiled into the assembly trying to access it.

Crystal, InstallShield, branching out in other programming realms.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close