How many times does UWP play GIF

华 张 136 Reputation points

I found some way to play GIFs in UWP, but there is no limit to the number of times. such as, I want to play a gif 4 times, What can I do?

Universal Windows Platform (UWP)
{count} votes

2 answers

Sort by: Most helpful
  1. Roy Li - MSFT 26,476 Reputation points Microsoft Employee


    Welcome to Microsoft Q&A!

    I want to control how many times GIF is played.

    There is no native UWP API that can control the repeat times for GIF files. In UWP apps, we use BitmapImage Class to show the GIF files. There are three properties that related to using GIF files, AutoPlay, IsAnimatedBitmap, IsPlaying. Nono of them could control the repeat times of the GIF.

    Thank you.

    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.

    No comments

  2. Castorix31 65,711 Reputation points

    You could use WIC to control the rendering, like the SDK sample WIC Animated Gif
    I only used WIC in Desktop Apps, but MSDN docs say it should work in UWP too (for WIC and Direct2D) :

    Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
    Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]

    No comments