You will need to convert the Image.Source
to a System.Windows.Media.Imaging.BitmapImage
in order to get your UriSource
.
MessageBox.Show(((System.Windows.Media.Imaging.BitmapImage)image.Source).UriSource.ToString());
Pergunta
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
Solução
You will need to convert the Image.Source
to a System.Windows.Media.Imaging.BitmapImage
in order to get your UriSource
.
MessageBox.Show(((System.Windows.Media.Imaging.BitmapImage)image.Source).UriSource.ToString());