动画Gif不在WPF中制作动画

时间:2012-04-09 03:20:43

标签: c# wpf animation

如何制作动画.gif动画以在WPF用户控件中为每个帧设置动画?这里的.gif只显示第一帧。

<UserControl.Triggers>
    <EventTrigger RoutedEvent="Button.Click" SourceName="btnPressQ">
        <EventTrigger.Actions>
            <BeginStoryboard Storyboard="{StaticResource sbdShowAlfa}"/>
        </EventTrigger.Actions>
    </EventTrigger>    
</UserControl.Triggers>

<Button Grid.Column="2" Command="{Binding Path=PressAndRelease}" CommandParameter="Q" Style="{StaticResource TransparentButton}">
                <Button.Template>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Image Name="imgNormalQ" Source="/Wosk;component/Images/Alphaberts/Q1.png" Height="127" />
                            <Image Name="imgPressedQ" Source="/Wosk;component/Images/Alphaberts/DancingPeaks.gif" Height="262" Width="119" Margin="-23,-136,-21,0" Visibility="Hidden"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Panel.ZIndex" Value="999"/>
                                <Setter TargetName="imgPressedQ" Property="Visibility" Value="Visible"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>

1 个答案:

答案 0 :(得分:0)

为什么不让动画gif驻留在帧外?每一帧上的动画.gif都可以对抗动画,因为每帧必须在每一帧上重新开始。