Rafael
Rafael

Reputation: 2049

.NET MAUI: Display svg-image file on iOS

Noticed, that svg-files, added to .NET MAUI project, to the folder Resources\Images\ do not display properly on iOS, while displaying ok on Android.

I use declaration:

<Image Source="myFile.svg" />

for image located at: Resources\Images\myFile.svg

And while it is displayed on Android, it does not show the image on iOS.

How can I fix this issue?

Upvotes: 2

Views: 2539

Answers (1)

Rafael
Rafael

Reputation: 2049

Upon referencing these files, do not specify the svg extension.

Instead of

<Image Source="myFile.svg" />

Use

<Image Source="myFile" />

It works ok on iOS and Android.

In some cases it would be good to specify HeightRequest, MinimumHeightRequest, WidthRequest and MinimumWidthRequest to display image properly.

Upvotes: 10

Related Questions