开发者

display image in silverlight 4

开发者 https://www.devze.com 2023-04-05 01:07 出处:网络
private void button1_Click(object sender, RoutedEventArgs e) { MyImage.Source = new BitmapImage(new Uri(\"../Image/\" + txtImage.Text,
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

精彩评论

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