c# wpf XamlParseException

Zaug 306 Reputation points
2022-01-27T12:03:37.577+00:00

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:

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


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

How do i fix it??

Developer technologies | Windows Presentation Foundation
{count} votes

1 answer

Sort by: Most helpful
  1. Zaug 306 Reputation points
    2022-01-28T12:28:41.557+00:00

    I Fixed the problem, thx for look my problem


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.