You can also use animated gifs, compare e.g. this site: http://www.loadinfo.net/. Different colors, forms, frames per second, transparant background are generated for you.
Then you add the WPF Animated GIF as a reference to your project.
Make a usercontrol with <Image gif:ImageBehavior.AnimatedSource="Images/animated.gif" />
as its content and give the usercontrol a dependencyproperty (DP) IsBusy
with a callback to a method in the usercontrol:
`public static readonly DependencyProperty IsBusyProperty = DependencyProperty.Register("IsBusy", typeof(bool), typeof(SpinProgress), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnIsBusyChangedCallBack)));`
In this method the animated gif's Play()
and 'Pause()' methods can be executed.
Bind the usercontrol's IsBusy
property to the view-model.
Or - when appropiate - ignore the DP and the Play()
and Pause()
methods and bind the Visibility
property to the view-model.