问题
When I choose to complete the first page photo Change to the second page of the selected photo will crashes Back
I have read this post
Crashes Back to AppPage from Home ('System.Windows.Media.ImageSource' cannot be serialized) WP8
but I don't know how to deleting BitmapSource Property
this is my code
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;
}
}
and Crashes Back message
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.
来源:https://stackoverflow.com/questions/20094020/crashes-back-writeablebitmap-cannot-be-serialized-windows-phone-8