简体   繁体   中英

Universal data type or library for loading images encoded as Base64 from XML file

I am about to develop an application with Xamarin.Forms that reads an XML file to display data. The XML file will be stored on the web so that the app does not need to be updated if only the content changes. Within the XML file there will be a section for images encoded as Base64 string (or byte array?), so that the application can decode and display images.

My problem is that I don't know how to display the images in Xamarin.Forms because iOS, Android and Windows don't support the same namespaces and libs. The basic c# code examples suggest a MemoryStream in combination with a Image but I can't use Image because System.Drawing does not seem to be supported on all platforms, so I am a bit lost at the moment. Is there any cross-platform solution for my problem? I'd rather not like to use platform hacks for this, so any cross-platform solution would be nice.

Xamarin Forms ImageView uses an ImageSource to display.

There is a http://developer.xamarin.com/api/type/Xamarin.Forms.StreamImageSource/ available, which takes a Stream or MemoryStream for input.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM