tags:

views:

24

answers:

1

There are several Image. Pressing the Image opens. How do I pass this window image, which I clicked?

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

This answer should help you.

If I understood you properly than:

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
        }
Eugene Cheverda
Нужно определить, на каком из Image мы кликнули. Sender содержит всю нужную информацию (нужный Uri, но как его вытащить из него?You must determine which of Image we clicked. Sender contains all the necessary information, but as it is to pull out of it?