开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜