开发者

display image in silverlight 4

private void button1_Click(object sender, RoutedEventArgs e)
{
  MyImage.Source = new BitmapImage(new Uri("../Image/" + txtImage.Text,
                                   UriKind.Relative));
}  开发者_Go百科

Why is the image not showing?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜