2010-09-04 51 views
0

有幾個圖片。按圖片打開。我如何通過這個窗口形象,我點擊?Image.Source在新窗口中

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(); 
    } 

回答

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 
     } 
+0

需要確定的形象,我們點擊。發件人包含所有必要的信息(正確的URI,但如何讓他離開呢? 您必須確定我們點擊其中的形象。發件人包含了所有必要的信息,但因爲它是拉出來的嗎? – user416903 2010-09-04 11:54:59