Xamarin.Forms, Bind image from Base64/Byte Array in iOS

ISUJoeISUJoe Member ✭✭
edited June 20 in Xamarin.Forms

How would I go about binding an image to my XAML, when the image comes in as a Hex string, that can get converted to a Base64 string or Byte Array. I've tried everything from all of these sites with no luck.
https://stackoverflow.com/questions/17821371/uiimage-loaded-from-url-in-xamarin-c-sharp
https://forums.xamarin.com/discussion/54409/convert-byte-array-to-image
https://www.c-sharpcorner.com/article/loading-base64-images-in-xamarin-forms/
https://stackoverflow.com/questions/49700625/xamarin-forms-ios-display-image-from-asset-catalog
https://docs.microsoft.com/en-us/xamarin/ios/app-fundamentals/images-icons/displaying-an-image?tabs=windows
https://stackoverflow.com/questions/43343966/binding-image-source-dynamically-on-xamarin-forms

Here's two snippets of C# that I've tried

                    token.AdvisorImage = UIImage.LoadFromData(NSData.FromArray(imageAsBytes));
                    UIImage image = FindByName("advisorImage") as UIImage;
                    image = UIImage.LoadFromData(NSData.FromArray(imageAsBytes));
                    token.AdvisorImage = new Image
                    {
                        Source = ImageSource.FromStream(() => new MemoryStream(imageAsBytes))
                    };

And here's the XAML:

        <ListView x:Name="AdvisorDTOView"
            ItemsSource="{Binding AdvisorDTOs}"
            HasUnevenRows="True">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout Orientation="Horizontal">
                            <Image
                                x:Name="advisorImage"
                                Source="{Binding AdvisorImage}"
                                Aspect="AspectFill"/>
Sign In or Register to comment.