Code Monkey home page Code Monkey logo

wpfanimatedgif's Introduction

WPF Animated GIF

Build status

Nuget package available here: WpfAnimatedGif.

A simple library to display animated GIF images in WPF, usable in XAML or in code.

It's very easy to use: in XAML, instead of setting the Source property, set the AnimatedSource attached property to the image you want:

<Window x:Class="WpfAnimatedGif.Demo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:gif="http://wpfanimatedgif.codeplex.com"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Image gif:ImageBehavior.AnimatedSource="Images/animated.gif" />

You can also specify the repeat behavior (the default is 0x, which means it will use the repeat count from the GIF metadata):

        <Image gif:ImageBehavior.RepeatBehavior="3x"
               gif:ImageBehavior.AnimatedSource="Images/animated.gif" />

And of course you can also set the image in code:

var image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(fileName);
image.EndInit();
ImageBehavior.SetAnimatedSource(img, image);

See the wiki for more details on usage.

Features

  • Animates GIF images in a normal Image control; no need to use a specific control
  • Takes actual frame duration into account
  • Repeat behavior can be specified; if unspecified, the repeat count from the GIF metadata is used
  • Notification when the animation completes, in case you need to do something after the animation
  • Animation preview in design mode (must be enabled explicitly)
  • Support for controlling the animation manually (pause/resume/seek)

Donate

WpfAnimatedGif is a personal open-source project. It is, and will remain, completely free of charge. That being said, if you want to reward me for the time I spent working on it, I'll gladly accept donations.

Donate

wpfanimatedgif's People

Contributors

thomaslevesque avatar dmitriishamrikov avatar ericvf avatar

Watchers

James Cloos avatar Daniel Hritzkiv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.