How many times does UWP play GIF

华 张 156 Reputation points
2022-12-27T02:24:06.267+00:00

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?

Developer technologies | Universal Windows Platform (UWP)
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-12-27T05:32:10.353+00:00

    Hello,

    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.

    0 comments No comments

  2. Castorix31 90,696 Reputation points
    2022-12-27T09:19:22.693+00:00

    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]

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.