c# wpf XamlParseException

Zaug 306 Reputation points

i work a project with visual studio 2022 and i use gifs.
i save the canvas and use method XamlWriter
but when i load canvas, i give an error

"System.Windows.Markup.XamlParseException: "Unable to set unknown member '{http://wpfanimatedgif.codeplex.com}ImageBehavior.AnimatedSource'." Line number '1' and line position '737'.'"

My Code is:

loadedEventrunned = false; 
FileStream fs = File.Open(projectpath, FileMode.Create);
XamlWriter.Save(canvasmain, fs);

loadedEventrunned = true;
FileStream fs = File.Open(projectpath, FileMode.Open, FileAccess.Read);
savedCanvas = XamlReader.Load(fs) as Canvas; //error at here
savedCanvas.PreviewMouseUp += canvasmain_PreviewMouseUp;
savedCanvas.PreviewMouseMove += canvasmain_PreviewMouseMove;

How do i fix it??

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,667 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Zaug 306 Reputation points

    I Fixed the problem, thx for look my problem