I'm trying that the animation starts at specific frame with WpfAnimatedGif
The specific frame is 13 the gif has 30 frames
(when the animation will play I want that it will play from the beginning and then return to frame 13)
Frame 13 is for being like thumbnail and when I hover the gif the gif start to play and after that, it returns to frame 13 and act like thumbnail
(Their Git Page, Their documentation page)
XAML:
<Image Name="MinimizeGIF" gif:ImageBehavior.AutoStart="False" gif:ImageBehavior.RepeatBehavior="3x" gif:ImageBehavior.AnimatedSource="/Media/arrow_bottom1.gif" MouseEnter="MinimizeGIF_MouseEnter" Height="58.262" Margin="460.674,60.801,68.004,0" VerticalAlignment="Top" Width="71.321" MouseDown="MinimizeGIF_MouseDown" MouseLeave="MinimizeGIF_MouseLeave" RenderTransformOrigin="0.5,0.5" Loaded="MinimizeGIF_Loaded">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="180"/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
C# code:
private void MinimizeGIF_Loaded(object sender, RoutedEventArgs e)
{
var image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(@"C:\Users\Me\Documents\Visual Studio 2017\Projects\Counting\Counting\arrow_bottom1.gif");
image.EndInit();
ImageBehavior.SetAnimatedSource(MinimizeGIF, image);
var controller = ImageBehavior.GetAnimationController(MinimizeGIF);
controller.GotoFrame(13); // It Goes to The Frame
MessageBox.Show(controller.CurrentFrame.ToString()); // Just for the function to stop and after that the gif return to frame 0
}
At MessageBox.Show(controller.CurrentFrame.ToString());
it's showing me -1
Can please someone help me?