private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ImageEx ex = (ImageEx)d; ex.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased); string newValue = (string)e.NewValue; ex.CreateFromSourceString(newValue); }
private static void OnStretchDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ImageEx ex = (ImageEx)d; StretchDirection newValue = (StretchDirection)e.NewValue; if (ex._gifAnimation != null) { ex._gifAnimation.StretchDirection = newValue; } else if (ex._image != null) { ex._image.StretchDirection = newValue; } }
private static void OnStretchWithStaticChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ImageEx ex = (ImageEx)d; Stretch newValue = (Stretch)e.NewValue; if (ex._image != null) { if (newValue != Stretch.None) { ex._image.Stretch = newValue; } else { ex._image.Stretch = ex.Stretch; } } }