dot net maui image control not showing remote source

Viewed 861

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.

2 Answers

There is a "new" ImageSource.FromUri

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