diff --git a/WpfAnimatedGif/ImageBehavior.cs b/WpfAnimatedGif/ImageBehavior.cs index 929a661..e045949 100644 --- a/WpfAnimatedGif/ImageBehavior.cs +++ b/WpfAnimatedGif/ImageBehavior.cs @@ -449,7 +449,14 @@ private static void InitAnimationOrImage(Image imageControl) SetAnimationController(imageControl, null); SetIsAnimationLoaded(imageControl, false); - BitmapSource source = GetAnimatedSource(imageControl) as BitmapSource; + var rawSource = GetAnimatedSource(imageControl); + BitmapSource source = rawSource as BitmapSource; + if (source == null && rawSource != null) + { + imageControl.Source = rawSource; + return; + } + bool isInDesignMode = DesignerProperties.GetIsInDesignMode(imageControl); bool animateInDesignMode = GetAnimateInDesignMode(imageControl); bool shouldAnimate = !isInDesignMode || animateInDesignMode;