示例#1
0
        private static void SourceChanged(AvaloniaPropertyChangedEventArgs e)
        {
            var image = e.Sender as Image;

            if (image == null)
            {
                return;
            }

            var instance = GetInstance(image);

            instance?.Dispose();

            var value = e.NewValue;

            if (value is string s)
            {
                value = new Uri(s);
            }

            instance = new GifInstance {
                TargetControl = image
            };
            instance.SetSource(value);
            SetInstance(image, instance);
        }
示例#2
0
 public static void SetInstance(Image target, GifInstance value)
 {
     target.SetValue(InstanceProperty, value);
 }