简体   繁体   中英

Loading Image in Silverlight

I want to create a WritableBitmap and display a bitmap from stream onto a Image object. How to do that in Silverlight. I am doing the following which is not working.

  Image img = new Image();

  System.IO.Stream stream =  File.OpenRead("1.bmp"); //Getting access permission error

  WriteableBitmap bmp1 = new WriteableBitmap(100, 100);
  bmp1.SetSource(stream);
  //do operations with bmp1 

  img.Source = bmp1;

In Silverlight, file I/O is pretty constrained.

Check this post

In Browser Silverlight Application - Client Side File/Directory access

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM