Question

i have a gif with transparent background

I used this code

<MediaElement Name="yourMediaElement" Margin="144,83,602,166">
        <MediaElement.Triggers>
            <EventTrigger RoutedEvent="MediaElement.Loaded">
                <EventTrigger.Actions>
                    <BeginStoryboard>
                        <Storyboard>
                            <MediaTimeline Source="videos/stick_figure_podium_speech_group_anim_150_clr_9408.gif"
                        Storyboard.TargetName="yourMediaElement"  
                        RepeatBehavior="Forever" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger.Actions>
            </EventTrigger>
        </MediaElement.Triggers>
    </MediaElement>

but it doesn't show the gif when i ran the code. it only shows in the design window with a black background

is there another way to load a gif image in wpf using vb?

Was it helpful?

Solution

You can look at this SO question or you can download this CodePlex project.

From second link:

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top