I want to get source of my image control by clicking the image in my wp7 application I try this one but not get solution.
Image img = new Image();
img.Source = new BitmapImage(uri);
img.Height = 105;
img.Width = 167;
img.Margin = new Thickness(Xpos, Ypos, 0, 0);
//img.Height = j;
img.MouseLeftButtonUp += new MouseButtonEventHandler(img_MouseLeftButtonUp);
void img_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
var image = (Image)sender;
MessageBox.Show(image.Source.ToString());
}
Please give me some idea how can i get source of my image control. Thanks in advance
您将需要将Image.Source
转换为System.Windows.Media.Imaging.BitmapImage
以获得UriSource
。
MessageBox.Show(((System.Windows.Media.Imaging.BitmapImage)image.Source).UriSource.ToString());
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.