Image.Source在新窗口中

时间:2010-09-04 11:02:37

标签: c# wpf

有几张图片。按图像打开。如何通过我点击的窗口图像?

image1.Source = new BitmapImage(new Uri();
...
imageN.Source = new BitmapImage(new Uri();

private void ShowPreview(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
             PopupWnd ww=new PopupWnd();
             ww.PopImage.Source = new BitmapImage(new Uri(??? need imageN));
             ww.Show();
    }

1 个答案:

答案 0 :(得分:0)

This answer should help you.

如果我理解你的话比:

void _imageN_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var image = sender as Image;
            var imageSource = image.Source as BitmapImage;
            imageSource.BaseUri.ToString(); //here it is your Uri
        }