可以使用wpfanimatedgif nuget软件包
我正在尝试制作一个使用“ wpfanimatedgif” nuget软件包的WPF项目()为了制作窗口背景gif。 但是由于某种原因,安装后我无法使用此软件包。我尝试使用软件包的名称空间,例如:
<Image gif:ImageBehavior.AnimatedSource="Resources\animated.gif"
gif:ImageBehavior.AutoStart="True"
gif:ImageBehavior.RepeatBehavior="1"/>
但是Visual Studio显示erros类似: “名称空间前缀” gif“未定义”。 我该怎么办来解决这个问题? 谢谢。
这是XAML代码:
<Window x:Class="TriviaGame.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TriviaGame"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Image gif:ImageBehavior.AnimatedSource="Resources\animated.gif"
gif:ImageBehavior.AutoStart="True"
gif:ImageBehavior.RepeatBehavior="1"/>
</Grid>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它抱怨的名称空间前缀是XMLN。您缺少:
在GitHub上查看示例代码。
https://github.com/xamlanimatedgif/wpfanimatedgif
The namespace prefix it's complaining about is an xmlns. You're missing:
See the example code on github.
https://github.com/XamlAnimatedGif/WpfAnimatedGif