2

I know that there are a few similiar questions but they don´t help me:

Have got the following code to show a Image in code behind:

BitmapImage logo = new BitmapImage();
logo.BeginInit();
logo.UriSource = new `Uri("pack://application:,,,/ApplicationName;component/Images/Klar.JPG");`
logo.EndInit();

The image is in the Images folder at the same level as the bin folder.

What is my mistake?

1
  • Ensure that the BuildAction is Content Commented Apr 13, 2012 at 18:41

1 Answer 1

2

For information about Pack URIs see here. I believe yours should be:

logo.BeginInit();
logo.UriSource = new Uri("pack://application:,,,/Images/Klar.JPG");
logo.EndInit();

which assumes that at the project level you have a folder called Images which contains a jpg called Klar.JPG.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.