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");
精彩评论