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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:19:33+00:00 2026-05-16T22:19:33+00:00

I have image in project added as resource, if I try to add it

  • 0

I have image in project added as resource, if I try to add it to my WPF project it always end up with

Error 1 The file images\background.png is not part of the project or its 'Build Action' property is not set to 'Resource'. C:\Users\Martinek\Documents\My\Learning.Dot.Net\WPF.8\WPF.8\Window1.xaml 21 47 WPF.8

I also tried to reference full path “file:///” etc. and same results even when image is added as resource

See also XAML code with results

<ImageBrush AlignmentX="Left" ImageSource="images/background.png" Stretch="Fill" />

Attaching image:
https://i.stack.imgur.com/bSjwi.png

  • 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-16T22:19:34+00:00Added an answer on May 16, 2026 at 10:19 pm

    I noticed that you have the Copy to Output Directory option set to “Do Not Copy.”

    Try changing it to either “Copy Always” or “Copy if newer” and see if that helps.

    Update

    I just wrote a quick sample app to try to figure this out. It seems to work properly, so I’ll post my code here hoping that it’ll help.

    <Grid>
      <Grid.Background>
        <ImageBrush x:Name="brush" AlignmentX="Left" ImageSource="images/have_the_dumb.jpg" Stretch="Fill" />
      </Grid.Background>
    </Grid>
    

    In the code-behind, I added some tracing code to see where the ImageBrush thinks its ImageSource is.

        public ImageDisplay()
        {
          Trace.Listeners.Add(new TextWriterTraceListener(@"c:\happyface.trace.log"));
          Trace.AutoFlush = true;
    
          InitializeComponent();
    
          Trace.WriteLine(String.Format("Image thinks it's in {0}", brush.ImageSource.ToString()));
        }
    

    When running that in Debug mode, you should see a line written to the Output window (as well as to the *.trace.log file) with the URI where it thinks the image is located.

    I ran it with the image in an images folder off the root of my solution. I tried it with the image set as “Content” (with “Copy if newer”) as well as “Resource” (with do not copy), and it ran successfully both times.

    Hope this points you in the right direction.

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

Sidebar

Related Questions

Within a Visual Basic Project I have added a resource file (resx) that contains
I have a WPF application and I added to the project resources many icons
I have an image which is added to the project. In the simulator it
I have a WPF application where I added the images as resources to the
I have added Images folder inside src folder in Java project. For setting top
we have a project that constitutes a large archive of image files... We try
Iam using c# vs2010. For my windows forms project I have some PNG,Gif,Jpg images
Suppose i have an animated GIF image name test.GIF added to my project in
I have a web project where I must import text and images from a
I have a image button. I wanted to add a text Search on it.

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.