Skip to content

Data URL & Embedded Resources support (including base64)

Daniel Luberda edited this page Mar 22, 2018 · 5 revisions

Following uri formats are supported

Data Uri support

  • data:image/png;base64,[BASE64ENCODEDFILE]
  • data:image/svg+xml;base64,[BASE64ENCODEDSVGFILE]
  • <SVG>NOT_ENCODED_SVGFILECONTENT</SVG>
  • data:image/svg+xml,<SVG>[NOT_ENCODED_SVGFILECONTENT</SVG>

Embedded Resources Uri support

  • resource://{resourceName}
  • resource://{resourceName}?assembly={Uri.EscapeUriString(resourceAssembly.FullName)}";

https://stackoverflow.com/questions/658446/how-do-i-find-the-fully-qualified-name-of-an-assembly

Xamarin.Forms

You can also use built-in ImageSource implementations:

new EmbeddedResourceImageSource(resourceName)
new EmbeddedResourceImageSource(resourceName, assembly)
new DataUrlImageSource(string dataUrl)