public static async Task SaveFileAsync(string FileName, T data)
{
MemoryStream memStream = new MemoryStream();
DataContractSerializer serializer = new DataContra
DataContractSerializer
won't work with images. You should either use BitmapEncoder (if you are dealing with WriteableBitmap
or simply serialize the source address of your BitmapImage
. If the bitmap was loaded from a local path or a temporary URL and you want to persist the entire bitmap - you can't extract the bitmap bits from BitmapImage
anyway and so you need to either download the source file from the original source URL or copy the local file you loaded. You could then either save that copy as a loose file or serialize as say Base64 inside of your DataContractSerializer
-created XML.