开发者

WPF C# Image Source

In 开发者_运维技巧XAML, I learned to specify image source with below code:

<Image Source="/WaivePadBankAnim;component/Images/Consumer/search_button_full.png" />

How would I do it in C# .cs?


Try this

Image image = new Image();
image.UriSource = new Uri("/WaivePadBankAnim;component/Images/Consumer/search_button_full.png")

Try this

Adding WPF Controls Progrrammatically


M working on Windows phone 8 and i used this.

OrderImage1.Source = new BitmapImage(new Uri("///Assets/images/order_bread.png"));


Image img = new Image();
img.Source = new Uri("<your path here>");

I hope this helps.


please check this

just use a class "ImageSourceConverter"

img1.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("/Assets/check.png");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜