开发者

Access to files in a folder in silverlight 3

I add a folder of image files in my silverli开发者_Go百科ght application. I want to put name of these files (jpg file) to arraylist. How can I access to these files in silverlight 3?



You could use the openFileDialog class if you are accessing files on your server.

http://msdn.microsoft.com/en-us/library/cc221415%28v=vs.95%29.aspx

This gives a good intro to how it works. You're going to have to write the logic of changing the stream into a BitmapImage. But that only 3 lines of code. I'll supply it if you want it.

However if you just want to access images within the application all you need to do is accesses them within the application by creating them as a new bitmapimage:

Image image = new Image();
image.Source = new BitMapImage(new Uri("imagesFolder/yourImageName.jpg",UriKind.RelativeOrAbsolute));
//set the height and width properties afterwards
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜