Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从windows phone中的列表框中获取所选图像? 我使用下面的代码将图像添加到列表框中。 公共类图像数据 { 公共字符串映像路径 { 得到; 设置 } 公共字符串名 { 得到; 设置 } } 私有无效图像\u单击(对象发送者,事件参数e) { 列表数据源=新列表() { 新建ImageData(){Name=“XXX”,ImagePath=“XXX.png”}, 新建ImageData(){Name=“YYY”,ImagePath=“YYY.png”}, 新建ImageData(){Name=“ZZZ”,ImagePath=“ZZZ.png”}, }; this.Image_List.ItemsSource=数据源; }_Image_Listbox_Windows Phone 8 - Fatal编程技术网

如何从windows phone中的列表框中获取所选图像? 我使用下面的代码将图像添加到列表框中。 公共类图像数据 { 公共字符串映像路径 { 得到; 设置 } 公共字符串名 { 得到; 设置 } } 私有无效图像\u单击(对象发送者,事件参数e) { 列表数据源=新列表() { 新建ImageData(){Name=“XXX”,ImagePath=“XXX.png”}, 新建ImageData(){Name=“YYY”,ImagePath=“YYY.png”}, 新建ImageData(){Name=“ZZZ”,ImagePath=“ZZZ.png”}, }; this.Image_List.ItemsSource=数据源; }

如何从windows phone中的列表框中获取所选图像? 我使用下面的代码将图像添加到列表框中。 公共类图像数据 { 公共字符串映像路径 { 得到; 设置 } 公共字符串名 { 得到; 设置 } } 私有无效图像\u单击(对象发送者,事件参数e) { 列表数据源=新列表() { 新建ImageData(){Name=“XXX”,ImagePath=“XXX.png”}, 新建ImageData(){Name=“YYY”,ImagePath=“YYY.png”}, 新建ImageData(){Name=“ZZZ”,ImagePath=“ZZZ.png”}, }; this.Image_List.ItemsSource=数据源; },image,listbox,windows-phone-8,Image,Listbox,Windows Phone 8,此代码工作正常 现在我想选择特定的图像并将其粘贴到图像控件或画布中 这是可能的 请帮帮我。提前感谢……。您应该使用SelectedItem属性并将其强制转换为ImageData I use the below code for add images into list box. public class ImageData { public string ImagePath { get; set;

此代码工作正常

现在我想选择特定的图像并将其粘贴到图像控件或画布中

这是可能的


请帮帮我。提前感谢……。

您应该使用SelectedItem属性并将其强制转换为ImageData

I use the below code for add images into list box.

public class ImageData
    {
        public string ImagePath
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }
    }
private void Images_Click(object sender, EventArgs e)

{
List<ImageData> dataSource = new List<ImageData>() 
                { 
                    new ImageData(){Name="XXX", ImagePath="XXX.png"},
                    new ImageData(){Name="YYY", ImagePath="YYY.png"},
                    new ImageData(){Name="ZZZ", ImagePath="ZZZ.png"},
                };

        this.Image_List.ItemsSource = dataSource;
}

有一个很好的例子说明了如何在msdn上使用它,您应该使用SelectedItem属性并将其强制转换为ImageData

I use the below code for add images into list box.

public class ImageData
    {
        public string ImagePath
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }
    }
private void Images_Click(object sender, EventArgs e)

{
List<ImageData> dataSource = new List<ImageData>() 
                { 
                    new ImageData(){Name="XXX", ImagePath="XXX.png"},
                    new ImageData(){Name="YYY", ImagePath="YYY.png"},
                    new ImageData(){Name="ZZZ", ImagePath="ZZZ.png"},
                };

        this.Image_List.ItemsSource = dataSource;
}
有一个很好的例子说明如何在msdn上使用它