3

I have added above code in my WPF from which include animated GIF image, the problem is whenever form load I don't find any of the Image displayed on form, any suggestions ???

<Image Name="imgScan"  Source="Images\Pre_Scan_RealImage.gif" />

I even tried Image element shown above

Prashant Cholachagudda
  • 13,012
  • 23
  • 97
  • 162

4 Answers4

11

Use XAML below

<MediaElement Height="30" Width="30" LoadedBehavior="Play" Source="Images\loading.gif" />

Set properties of loading.gif

  1. BuildAction : None
  2. Copy to Output Directory : Copy always

It should work.

Somnath
  • 3,247
  • 4
  • 28
  • 42
6

WPF at the moment doesn't natively support animated GIFs.

You can get around it by hosting the image in a PictureBox.

EDIT : Also checkout this thread for a bit more info.

Community
  • 1
  • 1
PaulB
  • 23,264
  • 14
  • 56
  • 75
2

I even tried Image element shown above

And did it work or not? ;)

The MediaElement does not yet support pack URIs. That means you'll need to include the GIF as an external file, not a resource. That may be your problem, but you'll need to provide more info if not.

Kent Boogaart
  • 175,602
  • 35
  • 392
  • 393
0

I fond UserControl here for showing Animated GIFs, and guess what work just works as simple as Image control.

And thank you all

Here's the same article (web post captured by the Wayback Machine)

Phil
  • 77
  • 6
Prashant Cholachagudda
  • 13,012
  • 23
  • 97
  • 162