I have a simple XAML code. It's give me an image object:
<Image x:Name="imageIcon"
Source="/Assets/Icon.png"
Width="160" Height="160"
Tapped="imageIcon_Tap" />
I would like to ask, how can I write this code in C# for my Windows Phone 8.1?
Ok,
A tried many solution about Nataniel answer, and born my solution:
imgIcon.Name = "ImgIcon";
imgIcon.Source = new BitmapImage(new Uri("ms-appx:///Assets/Icon.png"));
imgIcon.Width = (int)160;
imgIcon.Height = (int)160;
imgIcon.Tapped += imageIcon_Tap;
grid.Children.Add(imgIcon);
Thanks for Nataniel for his advice!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.