You can use the MediaTimeline element to create an animation loop forever:
<MediaElement Name="yourMediaElement">
<MediaElement.Triggers>
<EventTrigger RoutedEvent="MediaElement.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<MediaTimeline Source="YourAnimation.gif"
Storyboard.TargetName="yourMediaElement"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</MediaElement.Triggers>
</MediaElement>
EDIT: The solution above does not work with GIF files that are larger than a few kilobytes. The problem seems to come from Windows Media Player (it can be played using WMP itself). So, YMMV.
source
share