Pergunta

Does anyone know, how to download a Image from a path like "C:/Data/Users/Public/Pictures/Camera Roll/Picture.jpg" (in a Windows Phone 8.1 Device) and save it as a BitmapImage? I tried it with this, but after that I don't know, how to save the StorageFile as a BitmapImage.

StorageFolder picturesFolder = KnownFolders.CameraRoll;

StorageFile storageFile = await picturesFolder.GetFileAsync(fileName);

I hope someone can help me.

Cristian

Foi útil?

Solução

Create a stream out of the file and open it via SetSourceAsync (here).

using (var stream = await storageFile.OpenReadAsync())
{
  await bitmap.SetSourceAsync(stream);
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top