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 600441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:36:23+00:00 2026-05-13T16:36:23+00:00

I have a WPF control hosted in Windows Forms and I would like to

  • 0

I have a WPF control hosted in Windows Forms and I would like to access it’s resources, specifically images. What is the best way to do that?

I was thinking of using a ResourceDictionary, but I’m not sure how I can access it from within a Windows Form.

  • 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-13T16:36:23+00:00Added an answer on May 13, 2026 at 4:36 pm

    This is a standalone WPF control, in a DLL? There are two ways that the resources can be embedded… as part of a .resources file (e.g. the Project’s “Resoruces” tab), or as files included as “Embedded Resources”…

    To get the assembly reference to the DLL this is usually the easiest:

     var ass = typeof(ClassInOtherDll).Assembly;
    

    In the Resources

    If this is part of the default project resources, and not a different .resources file included inside the DLL, you can use the default base-name.

    var ass = typeof(ClassInTargetDLL).Assembly;            
    var rm = new ResourceManager("...BaseName...", ass);
    
    BaseName for default project resources is : 
      C# :=  Namespace.Properties.Resources
      VB :=  Namespace.Resources
    

    After that you can just call GetObject() and do a cast back:

    var myImage = rm.GetObject("check_16");
    return myImage as Bitmap;
    

    If you want to find out whats in there, get the assembly reference and call
    ass.GetManifestResourceNames()

    • .resources files can be used with a ResourceManager
    • embedded resources will just show up as a list. Use the other method for these.

    And this is all assuming they default culture =)

    As Embedded Resources

    You can use the regular methods on the assembly to get an embedded resource. You find it by name, and then Basically you will need to convert the stream back into your desired type.

    GetManifestResourceNames()
    GetManifestResourceStream(name)  
    
    • help getting the desired file with a helper function to find files by name.

    I usually use these like this:

    // called GetMp3 in the post, but it returns a stream.  is the same thing
    var stream = GetResourceStream("navigation.xml");
    var reader = New XmlTextReader(stream);
    return reader;
    

    To get an image that is an embedded resource, this works for me:

    var stream = GetResoureStram("check_32.png");
    var bmp    = new Bitmap(stream);
    this.MyButton.Image = bmp;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 307k
  • Answers 307k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you have to specify target explicitly in case where the… May 13, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer The FileSystemWatcher will trigger the events in a separate thread.… May 13, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer Without being sure what exactly causes the problem, I would… May 13, 2026 at 9:31 pm

Related Questions

I am currently working within a WPF user control (the root element of my
I have a WPF user control with a number of textboxes, this is hosted
I haven't used WPF that much so the solution to this is probably pretty
In the entry form of my wpf application, I have a list of buttons
I'm involved in a project which is able to connect to different hardware devices

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.