我想通过在我的wp7应用程序中单击图像来获取图像控件的源代码,我尝试了这个但没有得到解决方案。
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());
}请给我一些想法,我怎样才能获得我的图像控制的源代码。提前感谢
发布于 2012-11-29 12:42:33
您需要将Image.Source转换为System.Windows.Media.Imaging.BitmapImage,才能获得UriSource。
MessageBox.Show(((System.Windows.Media.Imaging.BitmapImage)image.Source).UriSource.ToString());https://stackoverflow.com/questions/13618747
复制相似问题