开发者

WPF C# Image Source

开发者 https://www.devze.com 2023-03-17 20:55 出处:网络
In 开发者_运维技巧XAML, I learned to specify image source with below code: <Image Source=\"/WaivePadBankAnim;component/Images/Consumer/search_button_full.png\" />

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

精彩评论

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