-1
private void button1_Click(object sender, RoutedEventArgs e)
{
  MyImage.Source = new BitmapImage(new Uri("../Image/" + txtImage.Text,
                                   UriKind.Relative));
}  

Why is the image not showing?

2
  • 1
    Welcome to Stack Overflow. In order to get this question answered we will need a little more information and context. What exactly is going wrong?
    – ChrisF
    Sep 14, 2011 at 14:43
  • +1: I have added the question they probably meant to ask. URLs in Silverlight have several twists that people need to be aware of. For that reason I am adding back a vote as -2 is a little harsh :) Sep 14, 2011 at 15:13

1 Answer 1

2

Your relative URI cannot contain and especially start with "../".

Unless it starts with a "/", or an absolute URL starting with "http://", it is assumed to be in a module.

A URL like "/images/imagename.jpg" will find the image located in the clientbin/images folder on the hosting website.

Also take a look at my answer here for more info: Binding image in Isolated Storage

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.