Burak Seyhan

Burak Seyhan

  • NA
  • 321
  • 29.1k

Wpf Gif Animation

Mar 11 2015 6:51 AM
public MainWindow()
{
InitializeComponent();
}
private string path = "/LoadSampleWpf;component/Image/loading.GIF";
public Image img { get; set; }
public BitmapImage Image { get; set; }
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.Image = new BitmapImage();
this.Image.BeginInit();
this.Image.UriSource = new Uri(path, UriKind.RelativeOrAbsolute);
this.Image.EndInit();
img = new Image()
{
Width = 100,
Height = 100,
StretchDirection = StretchDirection.DownOnly,
Stretch = Stretch.Fill,
Source = Image
};
ImageBehavior.SetAnimatedSource(this.img, this.Image);
ImageAnimationController controller = ImageBehavior.GetAnimationController(this.img);
if (controller != null)
{
controller.Play();
}
}
 
 
This code doesn't work.  Any solution for that ?