示例#1
0
        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);
        }
示例#2
0
        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;
            }
        }
示例#3
0
        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;
                }
            }
        }