How to get the Storyboard position?

GuoLearn 251 Reputation points
2021-12-06T02:24:11.61+00:00

The MediaPlayerElement have the Position propety like “MediaPlayer.PlaybackSession.Position.TotalMilliseconds” ,
Is the Storyboard have some way to get the current animation time ,Like the “MediaPlayer.PlaybackSession.Position.TotalMilliseconds” of MediaPlayerElement?

Universal Windows Platform (UWP)
{count} vote

Accepted answer
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,856 Reputation points
    2021-12-06T05:39:32.52+00:00

    Hello,
    Welcome to Microsoft Q&A!

    How to get the Storyboard position?

    Storyboard has no such progress event to report progress value real time. However, it has GetCurrentTime method to get current animation time span. for example, if the duration of animation is 3s and the return value GetCurrentTime method is 1.5s, it means the animation progress is 50%. Unfortunately, it is not real time. you need call the method base on your design such as use a time to report value regularly.

     var timespan = DownAnimiationStoryboard.GetCurrentTime();  
    

    Thank you.
    Nico Zhu


    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

0 additional answers

Sort by: Most helpful