[英]Retrieving original image from thumbnails in a LongListMultiSelector
i am using a LongListMultiSelector to display all the images from the Media Library. 我正在使用LongListMultiSelector来显示媒体库中的所有图像。 To prevent running out of memory , i used the following ode to display thumbnails.. this.DataContext = this;
为了防止内存不足,我使用了以下ode来显示缩略图:this.DataContext = this;
var Pictures = ml.Pictures;
foreach (var item in Pictures)
{
ListOfImages.Add(PictureDecoder.DecodeJpeg(item.GetThumbnail()));
name.Add(item.Name);
}
ListOfImages is the list binded to the LongList. ListOfImages是绑定到LongList的列表。
i have attached the OnSelectionChanged event handler to determine the selected images by the user , however i only get the thumbnails from their , how do i get the original image from it ??i want to store the original image to the isolated storage. 我已经附加了OnSelectionChanged事件处理程序来确定用户选择的图像,但是我只能从其缩略图中获取缩略图,如何从中获取原始图像?我想将原始图像存储到隔离存储中。
You need to have identifier for selected image (the name for example), then you can search for the actual image from MediaLibrary
by name : 您需要具有用于所选图像的标识符(例如名称),然后您可以按名称从
MediaLibrary
搜索实际图像:
var picture = media.Pictures
.FirstOrDefault(p => p.Name.Contains("the_name.jpg"));
if (picture != null)
{
// Picture found
var originalImage = picture.GetImage();
// do something with original image
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.