I would like to display some gif animation images in my application. The library I used to do it with Xamarin.Forms was Xamarin.FFImageLoading.Svg.Forms. Now that we are migrating our application to .net MAUI, I see that the MAUI document says that it supports GIF files. I tried a sample, but it did not work.
I have seen a gif related bug and workaround in the following link, and I also tried it, but for me the gif animation is still not working.
https://github.com/dotnet/maui/issues/5034
My code is on github, public repository.
https://github.com/rynjas/GifMauiSample
I would appreciate it if you could help me with this issue.
The steps to reproduce the issue are as follows:
<Image Source="giphy.gif" HeightRequest="200" HorizontalOptions="Center" />
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\*.gif" Resize="False" />
The issue is still not resolved.
According to the official documents by default when the gif image is loaded, by default it will not be played, Because IsAnimationPlaying
property is set to false
.
So, the gif image will not be played until you set IsAnimationPlaying
to true
.
Here is a tested/working example:
<Image Source="giphy.gif"
HeightRequest="200"
HorizontalOptions="Center"
IsAnimationPlaying="True" />
important alert is written in the docs:
While the animated GIF support in .NET MAUI includes the ability to download files, it does not support caching or streaming animated GIFs.
Also be aware for android that if it does not play in hot reload set IsAnimationPlaying
to false
and then set it back to true
, while you are in hot reload mode and it should work fine
iOS and Mac are still facing some issues so you can keep track through: GitHub issue
Microsoft docs: .NET MAUI gif images