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 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

Related Questions

I have a WPF control, that has a list of Investors, and in the
Using WPF, I have a TreeView control that I want to set its ItemTemplate
I am trying to host a custom Windows Forms control in WPF. My custom
I have a WPF user control with a number of textboxes, this is hosted
I have a winforms app but I would like to introduce a WPF user
I have a WPF user control that is dervied from UserControl class. MouseLeftButtonDown is
If you have a WPF control library which you wanted to license to developers,
The WPF control WindowsFormsHost inherits from IDisposable. If I have a complex WPF visual
Each item in a WPF ListBox control seems to have a bit of left
So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart)

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.