当我选择完成第一页照片时 更改为所选照片的第二页将崩溃返回
我已阅读此帖
Crashes Back to AppPage from Home ('System.Windows.Media.ImageSource' cannot be serialized) WP8
但我不知道如何删除BitmapSource属性
这是我的代码
PhotoChooserTask pc;
BitmapImage finalImage;
pc = new PhotoChooserTask();
pc.Completed += new EventHandler<PhotoResult>(pc_co);
public void pc_co(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
finalImage = new BitmapImage();
finalImage.SetSource(e.ChosenPhoto);
img.Source = finalImage;
}
}
和Crashes Back消息
exception {System.Runtime.Serialization.InvalidDataContractException: Type 'System.Windows.Media.Imaging.WriteableBitmap' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.