1
Vote

Switching AnimationMode not working

description

I have a scenario where I would like the image to initially render in the XAML with AnimationMode = "None"

However, upon the "Hold" event trigger, I would like to change the AnimationMode to Repeat.
        private void AnimatedImage_Hold(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (sender is AnimatedImage)
            {
                var animatedImage = sender as AnimatedImage;
                animatedImage.AnimationMode = AnimationMode.Repeat;
                animatedImage.Start();
            }
        }
It seems to work if I Hold, and then immediately Tap the image afterwards, it plays, but that is a strange and undesired behavior.

The only solution I have found is setting the AnimationImage to have an AnimationMode of PlayOnce, and then the behavior works as expected, but I really don't want to play it once until the User interacts with it via the Hold gesture.

comments