1

I have this code:

imgImage.Source = new BitmapImage(new Uri("Images/LivingRoom/chair.png", UriKind.Relative));

this gives me:

{pack://application:,,,/ExpressFurnitureSystem;component/ui/Images/LivingRoom/chair.png}

Here i want to delete (ui) or go one folder up. My requirement is:

{pack://application:,,,/ExpressFurnitureSystem;component/Images/LivingRoom/chair.png}

Because I have all my image files under Image folder not under UI/Image.

Thanks for your help in advance.

2 Answers 2

5

Have you tried the following? (i.e. Adding ../ at the beginning)

imgImage.Source = new BitmapImage(new Uri("../Images/LivingRoom/chair.png", UriKind.Relative)); 

I'm not sure if that will do it, but usually two periods allows you to move up one level.

1
  • Wonderful. It did work. I didn't know that ".." would work in string. But it did..Thanks a lot!
    – usergaro
    Commented Dec 28, 2011 at 21:34
2

Use ../Images/LivingRoom/chair.png.

1
  • Wonderful. It did work. I didn't know that ".." would work in string. But it did..Thanks a lot!
    – usergaro
    Commented Dec 28, 2011 at 21:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.