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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:50:36+00:00 2026-05-25T10:50:36+00:00

This has been driving me crazy for the past 2 days, and anything close

  • 0

This has been driving me crazy for the past 2 days, and anything close that I find just does not seem to work in my situation, perhaps someone can point out what I’m doing wrong.

I have a WPF project to which I’ve include a fairly large number of images(80ish). I’ve added them to the project into a folder called “Images”. They are currently set to be embedded resources(though I’ve tried regular resources as well) but nothing seems to work.

I am attempting to create and load an ArrayList of type Image using these files as the source, but I’m failing pretty bad.

private void addPicture(string name)
{            
    string filePath = "pack://MyApp_WPF:,,,/Images/" + name + ".png";
    Stream imageStream = assembly.GetManifestResourceStream(filePath);

    Image curImage = new Image();
    BitmapImage bmpImage = new BitmapImage();
    bmpImage.BeginInit();
    bmpImage.UriSource = new Uri(filePath, UriKind.Relative);
    bmpImage.EndInit();
    curImage.Height = 60;
    curImage.Stretch = Stretch.Uniform;
    curImage.Source = bmpImage;
    curImage.Margin = new Thickness(5);

    imageList.Add(curImage);
}

It was much easier to do in my windows form application, but I just cant figure it out with WPF… Any help besides links to resources would be nice, because chances are at this point I’ve already read them.

  • 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-25T10:50:37+00:00Added an answer on May 25, 2026 at 10:50 am

    First thing to note is that there is an DownloadError event that you ought to subscribe to, this might explain what is happening and why (though sometimes the error message is rather generic); the next is that you might not need the pack:// URI construct with images build actions of Resource:

    var bmpImage = new BitmapImage(new Uri(
        string.Format("/Images/{0}.png", name", UriKind.Relative));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has been driving me crazy the past few days. I wrote a program
This has been driving me crazy for the past few days. I've done something
This has been driving be crazy, but I can't seem to find an answer.
This has been driving me crazy because I can't find anything on Google. Maybe
This has been driving me crazy the past couple of days. I'm trying to
This is homework that has been driving crazy for the last couple of days.
This has been driving me crazy for the past few minutes I have a
so I am having this issue that has been driving me crazy for hours,
I've been driving myself crazy over the past few days over this one. We've
This has been driving me crazy for the past couple of hours. I have

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.