Hello, I was looking for information because I was going through the same problem, and in the end I found your question right after I found an answer (rs).
Well, to put a Gif in a WPF window, I used a <MediaElement>
. In my case, something like this:
<MediaElement x:Name="mediaElement" MediaEnded="mediaElement_MediaEnded" HorizontalAlignment="Center" Height="200" Margin="0" VerticalAlignment="Center" Width="200" Source="CaminhoAbsolutoPara/Gif.gif" Stretch="Fill" UnloadedBehavior="Manual" LoadedBehavior="Play"/>
And then I created an event for Gif to enter a loop. In the Mediaended event I put a code like this:
private void mediaElement_MediaEnded(object sender, RoutedEventArgs e)
{
mediaElement.Position = new TimeSpan(0, 0, 1);
mediaElement.Play();
}
Well, just a small explanation for the code: the Source path to Gif, should be absolute. For example: C://...image.gif
In the event, the name mediaElement.Position
... and mediaElement.Play
, is the name you gave to your Mediaelement in the excerpt x:Name="mediaElement"
As for the properties HorizontalAlignment="Center" Height="200" Margin="0" VerticalAlignment="Center" Width="200"
is something personal to you.
I hope I was able to help you. Hug.
Your link is already invalid. Other gifs work?
– Rodrigo Guiotti
@Rodrigoguiotti, I just tested this one. The thing is, I don’t know how to work with animated gif. I have to do something in the code or in the shampoo?
– pnet
you can do it both ways, but in the shampoo you have to download a package...
– Rodrigo Guiotti
I found here the name: Wpfanimatedgif
– Rodrigo Guiotti
@Rodrigoguiotti, man, you know where I can find a T-shirt that’ll teach me to trample with this guy?
– pnet
only in English... then when I have more time, I can even translate more things from there... that’s why I haven’t put together an answer now: https://wpfanimatedgif.codeplex.com/documentation
– Rodrigo Guiotti