Foul Plumbing
Foul Plumbing

Reputation: 39

dot net maui image control not showing remote source

I am having trouble with the Image control in .NET Maui when using a remote source. I am using Visual Studio 2022 Preview Version 17.2.0 Preview 4.0. When I use a URL for the source attribute of an Image control nothing shows up.

In VS 2022 I "Create a new project" then modify the MainPage.xaml file of the .NET MAUI template as follows...

-----------------original--------------------
<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
WidthRequest="250"
HeightRequest="310"
HorizontalOptions="Center" />

-----------------modified-------------------
<Image
Source="https://myWeb.com/logo.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
WidthRequest="250"
HeightRequest="310"
HorizontalOptions="Center" />

The image does not show up in the Android emulator or in an actual Android device. It does, however, show up in an iOS device.

Upvotes: 2

Views: 3032

Answers (2)

Morten OC
Morten OC

Reputation: 1784

There is a "new" ImageSource.FromUri

var mainImage = new Image
{
    HeightRequest = 200,
    Source = ImageSource.FromUri(new Uri(model.MainImage))
};

Upvotes: 1

Gerald Versluis
Gerald Versluis

Reputation: 34013

There are multiple open bugs right now for that. It seems that something broke all the image loading in Android. Should be fixed asap.

Upvotes: 1

Related Questions