Adding image from project space in C# xaml.cs
This is nothing short of embarrassing to ask but I'm havin开发者_开发百科g no luck with searches today.
I have an image plane.png which I have added as an existing item to my project "Rem". I have map.xaml in this, but since I want to add multiple "plane.png" images to this, I am trying to create them in map.xaml.cs
The XAML code to do what I want is simply: <Image Source="plane.png"/>
Would some kind soul be able to tell me what the C# equivalent to this is?
Thanks very much in advance,
M
Image i = new Image();
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri("plane.png", UriKind.Relative);
bi.EndInit();
i.Source = bi;
精彩评论