开发者

Image.Source in new window

开发者 https://www.devze.com 2023-01-15 07:35 出处:网络
There are several Image. Pressin开发者_开发问答g the Image opens. How do I pass this window image, which I clicked?

There are several Image. Pressin开发者_开发问答g 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();
    }


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

精彩评论

暂无评论...
验证码 换一张
取 消