应用程序运行时,动画gif不起作用

Sto*_*dza 1 c# wpf animated-gif

我从codeplex下载了WPFAnimatedGiff.dll.这就是问题所在:我正在尝试在标签项中实现giff.giff实际上是一个循环进度条,所以我试图模拟标签项的加载过程,类似于谷歌Chrome进度条.我插入了图像,它在设计器中可见,但在运行我的应用程序时它不会显示.此外,当我在网格中的其他位置插入图像时,它确实显示出来.这是代码:

<Window x:Class="WPFHotel.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPFHotel"
    xmlns:data="clr-namespace:WPFHotel.Database"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:gif="http://wpfanimatedgif.codeplex.com" />


 <TabItem Tag="PB1" Header="Rezervacije" Name="Reservations" BorderBrush="Black" FontFamily="Times New Roman" FontWeight="Bold" FontSize="14">
            <TabItem.HeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">                            
                        <TextBlock Text="Rezervacije" Margin="5,2,0,0" />
                        <Image gif:ImageBehavior.AnimatedSource="Images/468.gif" Stretch="None" />                           

                    </StackPanel>                        
                </DataTemplate>
            </TabItem.HeaderTemplate>
</TabItem>
Run Code Online (Sandbox Code Playgroud)

尝试谷歌的解决方案,但找不到任何有用的东西,所以我希望有人可以帮助我. 编辑:只是提到我插入这样的图像时:

<Image Source="Images/CircleBar.gif" />
Run Code Online (Sandbox Code Playgroud)

它在应用程序运行时显示,但没有旋转/动画.

Dar*_*vil 5

有两种解决方案

  1. 创建UserControl并在StackPanel的任何网格中添加XAML
  2. 设计一个WindowsForm,在其上添加动画控件,然后在WPF代码中调用它,但请记住,你必须设置该动画控件的两个属性,一个是它的StartPosition,另一个是TopMOST = True