Hello,
I'm evaluating the Persistence Framework and i have some questions.
I have attached a sample with a listview and a datatemplate in app with a xamDataGrid inside.
1) I'm saving the state of the listview but when I'm loading back the state, any actions made (e.g sorting) in the xamDataGrid is not loaded? How can this be achieved?
2) I have a two buttons in the sample to change the background of the item in the listview (using Solidcolorbrushes in App in order to have dark and a blue "theme"). If the state is saved and the theme is blue, when changing to dark and loading the state, the theme is still dark and to blue. How can i save this information too?
3) I'm using MVVM in my Application, is this gonna have any affect with the Persistence Framwork?
Thanks,
George
Hi George,
I'm writing to let you know that #211584 is already resolved in the new 16.1 WPF documentation.
Hello George,
In a nutshell the Control Persistency Framework(CPF) traverse the properties(recursively) of the object which state is being saved and saves these properties values.
1) Since the ListView does not expose the actual representations of its items the CPF does not have a way inspect/persist/load these specific properties of the XamDataGrid that are storing its state with regard to filtering, sorting etc. On the other hand the CPF doesn’t play very well with XamDataGrid control and in fact the it has its own ways of persisting its state - http://ko.infragistics.com/community/forums/t/83754.aspx in theory there would be a way to plug the XamDataGrid’s way of save/load but since there is no way to for the framework to get to these grids we could not use this approach.
2) The applied theme is not persisted since it’s basically defined in Application.Current.Resources where the styles are. The CPF doesn’t know of these styles or where they are defined and because it is persisting only the listView properties.
3) Here are two things that shoul1)d be considered when using the CPF in a MVVM app:
3.1) CPF might try to persist parts of your ViewModel when persisting the values of the properties of the controls that would be bound to parts of the VM. Depending on the VM structure CPF might end up persisting huge amounts of data that is part of the VM that might not make sense to be persisted. There have some ways to control what is being persisted for a specific object either by using the persistence settings specifying which properties should be ignored or ignoring certain properties of certain types by handling the setting.Events. Another way to control what should be saved or not is to make a particular custom control that you might be using CPF aware by implementing IProvidePropertyPersistenceSettings.
3.2) The Infragistics Persistence Framework™ does not intrinsically persist certain types of properties. Some examples include: AttachedProperties, DataTemplates, Paths, ControlTemplates, Styles and ItemPanelTemplates. The help states that this limitation could be overcome by using that identifier you’ve already tried. Unfortunately the Identifier part is only working for the Silverlight(because in SL Styles are inheriting from DependacyProperty and that’s not the case in WPF) version of the CPF and it is bug in the docs. I’ve created a support case on your behalf - CAS-168068-X8F1Q9. The support case is linked to the development issue #211584.
Let me know if I could be of further assistance.
Also when I tried to add the identifier in a style like the documentation (http://help.infragistics.com/Help/Doc/WPF/2012.2/CLR4.0/html/Persistence_Identifier.html) I get the following error: The attached property "Identifier" can only be applied to types that are derived from "DependencyObject".
What I'm doing wrong?
Thanks