I've tried to use WpfAnimatedGif in a new WPF project
https://github.com/XamlAnimatedGif/WpfAnimatedGif
But get the error message
error MC3072: The property 'ImageBehavior.AnimatedSource' does not exist in XML namespace 'http://wpfanimatedgif.codeplex.com'.
Proposed solutions from
don't seem to help:
I have installed the package from Nuget (tried versions 2.2.0, 1.2.3 and 1.1.10), and git.exe is in my global path. The project is inside a local git repo.
Anyone having any idea what the root cause could be?
MainWindow.xaml:
<Window x:Class="GifWpfTest.MainWindow"
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:d=http://schemas.microsoft.com/expression/blend/2008
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006
xmlns:gif=http://wpfanimatedgif.codeplex.com
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Image gif:ImageBehavior.AnimatedSource="gif.gif" />
</Grid>
</Window>
Csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="XamlAnimatedGif" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="gif.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Try this markup that should be compatible with the newer
XamlAnimatedGif
package, which is a complete rewrite of the older WpfAnimatedGif
project:
<Window x: Class="GifWpfTest.MainWindow"
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns: d=http://schemas.microsoft.com/expression/blend/2008
xmlns: x=http://schemas.microsoft.com/winfx/2006/xaml
xmlns: mc=http://schemas.openxmlformats.org/markup-compatibility/2006
xmlns: gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
mc: Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Image gif: AnimationBehavior.SourceUri="Images/loading.gif" />
</Grid>
</Window>
See the docs for more information.