崩溃后退(WriteableBitmap无法序列化)windows phone 8

时间:2013-11-20 10:57:59

标签: c# windows-phone-7 windows-phone-8

当我选择完成第一页照片时 更改为所选照片的​​第二页将崩溃返回

我已阅读此帖

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.

0 个答案:

没有答案