你如何在 Silverlight 中设置 Image.Source(代码隐藏) [英] How do you set Image.Source in Silverlight(Code behind)
本文介绍了你如何在 Silverlight 中设置 Image.Source(代码隐藏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过 Silverlight 中的代码隐藏动态生成图像,显然图像源不接受字符串或 Uri 作为路径.
I am dynamically generating an image through code-behind in Silverlight and apparently the image source doesn't accept a string or Uri as a path.
如何设置源?
推荐答案
你是什么意思不接受字符串作为源?
How do you mean it won't accept a string as source?
你不能这样做吗?
或者您是说您的图像在内存中而您不知道如何引用它?
Or are you saying your image is in memory and you don't know how to reference it?
this.MyImage.Source = new BitmapImage(new Uri("/MyNameSpace;images/someimage.png", UriKind.Relative));
这篇关于你如何在 Silverlight 中设置 Image.Source(代码隐藏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文