I am using PersistenceManager to save XamDiagram to a file and upon reloading, none of the styles working. What am I missing?
Hello Abs,
Thank you for contacting Infragistics.
The PersistenceManager does not save AttachedProperties, DataTemplates, Paths, ControlTemplates, Styles, and ItemPanelTemplates. Please try calling the RefreshLayout method on the XamDiagram.
Let me know if you have any questions regarding this matter.
Thank Michael for the advice, I have followed it, however it did not work. Can you please take a look at the attachment and see what is missing from here?
Thank you for following up. Please add your styles to your Node and Connection definitions each time you perform a load from the PersistenceManager.
eg.
private void LoadButtonOnClick(object sender, RoutedEventArgs e) { using (IsolatedStorageFile file = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, null, null)) { if (file.FileExists(DiagramFileName)) { using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(DiagramFileName, FileMode.OpenOrCreate, file)) { PersistenceManager.Load(EmployesDiagram, stream); Style nodeStyle = this.Resources["EmpNode"] as Style; Style connectionStyle = this.Resources["EmpNodeConnection"] as Style; EmployesDiagram.ConnectionDefinitions[0].ConnectionStyle = connectionStyle; EmployesDiagram.NodeDefinitions[0].NodeStyle = nodeStyle; } } } }
For more details, I've modified your sample and I have attached it to this thread below. Let me know if you have any questions.