【问题标题】:Image.Source in new windowImage.Source 在新窗口中
【发布时间】:2011-02-02 11:06:02
【问题描述】:

有几个图像。按图像打开。如何传递我点击的这个窗口图像?

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

【问题讨论】:

    标签: c# wpf


    【解决方案1】:

    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
            }
    

    【讨论】:

    • Нужно определить, на каком из 图片мы кликнули。发件人 содержит всю нужную информацию (нужный Uri, но как его вытащить из него?您必须确定我们点击了哪个图像。发件人包含所有必要的信息,但要拔出它吗?
    猜你喜欢
    • 2014-03-24
    • 1970-01-01
    • 1970-01-01
    • 2013-09-06
    • 1970-01-01
    • 1970-01-01
    • 2010-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多