开发者

How to create Uri pointing to an local image in Silverlight?

开发者 https://www.devze.com 2023-02-05 20:50 出处:网络
I was wondering if it is allowed to read local images within a Silverlight client. (it is just to test a control)

I was wondering if it is allowed to read local images within a Silverlight client. (it is just to test a control)

var image = new BitmapImage { UriSource = new Uri("../Images/2.jpg", UriKind.Relative) };

Would this Uri be allowed and the image created? For some reason the picture doesn't show, despite getting no compiler errors that the Uri might have been wrong...

Tha开发者_StackOverflow中文版nks for advice, kave


Assuming your project looks like this

 - Project
      - Images
           - 2.jpg
      - Another_Folder
           - *your code file*

, that should be fine.


Remember that

../Images/2.jpg

is navigating to parent folder, then looking for an Images folder and a 2.jpg file.

0

精彩评论

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

关注公众号