Called when the window is saved to a workspace, which is called before OnWindowDestroyed(). This method is used to save any custom XElement data associated with your window.
Method Return Value
This method does not return a value
OnWindowSaved(Window window, XElement element)
A Window object which is being saved to the workspace
A XElement object representing the workspace being saved
protected override void OnWindowSaved(Window window, XElement element)
Print("OnWindowSaved for " + window.GetHashCode());
// create a new XElement to save the last state of a custom button to the workspace
XElement xml = new XElement("SampleAddOn", new XElement("ButtonState", true));
// add the new element to the workspace which can be restored later
//Don't forget to call the base OnWindowSaved method after you've finished your operation.