I'm tearing my hair out over this and could REALLY use some help. I've tried using both wpfanimatedgif and xamlanimatedgif but the problem persists.
So I have a solution with two projects:
- A WPF User Control Library (WindowLibrary)
- A WPF Application (Launcher)
In WindowLibrary I have an xaml i'm using for the style of my Launcher. The xaml is called "Default_Style.xaml".
In that - I am trying to display an animated gif in an image which I have set as part of a style...
<!-- Window Icon -->
<Image
Grid.Column="0"
Width="16"
Height="16"
Margin="5,0"
gif:ImageBehavior.AnimatedSource="pack://application:,,,/WindowLibrary;component/Resources/gifs/SonicMania_Ring.gif"/>
I've got the nuget package WPFAnimatedGif installed to the WindowLibrary and have referenced it at the top.
<ResourceDictionary xmlns=";
xmlns:x=";
xmlns:gif=";>
I've got the SonicMania_Ring.gif set as a resource in it's properties...
I think I've done everything I possibly need to do to get this to work... and yet I get this error...
System.Windows.Markup.XamlParseException
HResult=0x80131501
Message='Cannot set unknown member '{}ImageBehavior.AnimatedSource'.' Line number '73' and line position '29'.
Source=PresentationFramework
StackTrace:
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) in System.Windows.Markup\XamlReader.cs:line 401
at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri) in System.Windows.Markup\XamlReader.cs:line 396
at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter) in System.Windows\FrameworkTemplate.cs:line 780
at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField) in System.Windows\FrameworkTemplate.cs:line 687
at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren) in System.Windows\FrameworkTemplate.cs:line 517
at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate) in System.Windows\StyleHelper.cs:line 920
at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container) in System.Windows\FrameworkTemplate.cs:line 488
at System.Windows.FrameworkElement.ApplyTemplate() in System.Windows\FrameworkElement.cs:line 1706
at System.Windows.FrameworkElement.MeasureCore(Size availableSize) in System.Windows\FrameworkElement.cs:line 3485
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Window.SetRootVisualAndUpdateSTC() in System.Windows\Window.cs:line 2209
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight) in System.Windows\Window.cs:line 2194
at System.Windows.Window.CreateSourceWindow(Boolean duringShow) in System.Windows\Window.cs:line 2053
at System.Windows.Window.ShowHelper(Object booleanBox) in System.Windows\Window.cs:line 3427
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore) in System.Windows\Application.cs:line 1539
at System.Windows.Application.RunInternal(Window window) in System.Windows\Application.cs:line 1214
at Launcher.App.Main()
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
XamlObjectWriterException: 'Cannot set unknown member '{}ImageBehavior.AnimatedSource'.' Line number '73' and line position '29'.