private static void ImageUrlPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var url = (string)e.NewValue; var image = (CachedImage)obj; // clear if nothing set if (string.IsNullOrEmpty(url)) { image.Source = null; return; } image.Animate = false; Storage.LoadImageFromVpdb(url).Subscribe(bmp => { // process on main thread System.Windows.Application.Current.Dispatcher.Invoke(delegate { if (image.Animate) { image.Opacity = 0; } image.Source = bmp.ToNative(); if (image.Animate) { image.BeginAnimation(OpacityProperty, FadeInAnimation); } }); }, err => { Logger.Error(err, "Error downloading {0}.", url); }); Observable.Timer(WaitForFadeInDuration).Subscribe(_ => image.Animate = true); }