Maui - show Image from string base 64

Dani_S 3,086 Reputation points


I have base 64 string , how i show it in image control?


A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,064 questions
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,646 Reputation points Microsoft Vendor


    You can convert base64 string to byte[] by Convert.FromBase64String(String) Method, then read byte[] to stream, set the stream to the imagesource like following code.

    ImageSource.FromStream(() => new MemoryStream(Convert.FromBase64String(base64String)));

    If you are using MVVM, you can set the ImageSource to your property in the viewmodel.

    Best Regards,

    Leon Lu

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful