Hello,
The Source property of the Image control in Maui corresponds to the ImageSource class. In ViewModel, you can refer to Load a local image to load Source in the following way.
private ImageSource logoImage;
public ImageSource LogoImage
{
get
{
return logoImage;
}
set
{
if (logoImage != value)
{
logoImage = value;
OnPropertyChanged(); // reports this property
}
}
}
//You can assign values directly using the file path
LogoImage = "test.png";
LogoImage = ImageSource.FromFile("test.png");
// You can assign a value via a Uri, which is usually suitable for remote files.
LogoImage = ImageSource.FromUri(new Uri("https://aka.ms/campus.jpg"));
// If your image is a Stream read from a file, you can convert it to an ImageSource in this way;
LogoImage = Source = ImageSource.FromStream(() => your_file_stream);
Best Regards,
Alec Liu.
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.