XamlAnimatedGif / WpfAnimatedGif

A simple library to display animated GIF images in WPF, usable in XAML or in code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RepeatBehavior does not exist in current context

Startestor opened this issue · comments

I'm trying to understand why RepeatBehavior isn't in the current context. Simple code with WpfanimatedGif referenced in Project, and "using WpfanimatedGif" included also. Code is:
#region Create Loading graphic

    public void workingIndicator()
    {

        var image = new BitmapImage();
        image.BeginInit();
        image.UriSource = new Uri(@Globals.fileName, UriKind.Relative);
        image.EndInit();
        ImageBehavior.SetAnimatedSource(Working, image);
        ImageBehavior.SetRepeatBehavior(Working, new RepeatBehavior(0));
        ImageBehavior.SetRepeatBehavior(Working, RepeatBehavior.forever);

    }

    #endregion Create Loading Graphic

I did rebuild the WpfanimatedGif project to use dotnet4.0 and had to add System.Xaml as a Reference.
fileName is a static Global variable that I use to change the animated Gif based on my Project code.

If I comment out this code, the first animated Gif runs 1 time and stops. Your thoughts would be greatly appreciated. Thanks in advance.

Finally found what the code was looking for. Needed to add : "using System.Windows.Media.Animation;" to the main project and all is now working.