Hi,
We are using XamDockManager in our project. Panes (split/tabgroup & content) are dynamically created based on user action. As part the project, we need to save the layout to file and re-load it on opening the application back.
I referred the sample (Saving & Loading layout of XamDockManager) and followed the same in our project. But seems its not working. To mimic the issue, I have created a stand-alone application (find attached). On clicking save, I am saving the layout to file and disposing the dockManager (this would be the state on closing the application). On clicking load, I am initializing the dockManager and loading the layout from file. DockManager is getting shown but not the layouts.
Please help me in getting this resolved.
Thanks,Mahadev
Hello Mahadev,
Thank you for your post. I have been looking into it and I can suggest you see this forum thread:
http://es.infragistics.com/community/forums/t/13501.aspx
where a similar issue has already been discussed. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thanks for the reply.
I looked at the mentioned post and looks like it does not provide proper conclusion. Anyway I will give a try with attached sample and post an update by EOD today. Meantime it would be great if you could try from your end as well.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thanks for the quick and detailed mail. I understood the details on reading the post. I could now load the layout by handling InitializePaneContent event and it solved my problem.
Just a suggestion. I think it is better to include/mention this in the samples. Because, looking at the Save/Load Layout sample, I thought persistense of Layout information is straight forward and it is fully handled by Infragistics. But only after hitting the problem, got to know that we need to handle this event to achieve the real persistence (as everything would be new on re-opening the application).
Thanks once again.
Actually the point I made in the original reply to that post is directly applicable. The xamDockManager does not create and add ContentPane instances automatically based on what is in the layout file. Instead it takes the ContentPanes that it already has a reference to (i.e. those currently within the XDM's pane hierarchy at the time of the LoadLayout call) and based on their ContentPane's Name matches up against the ContentPane information in the provided layout file (i.e. the name stored for the ContentPane). In your case there are no ContentPane instances when you load the layout so nothing will show unless you handle and use the InitializePaneContent event as mentioned in my reply in the other post.
So just to be clear what will happen is that during the processing of the LoadLayout call if we find a ContentPane mentioned in the layout file that does not exist then we raise the InitializePaneContent event and give you a chance to provide/initialize that. If after that event is raised you either have not changed the Content or have not set the NewPane property we will discard/ignore any information about that pane during the processing of the LoadLayout call. So basically you need to handle that event and set the Content (and initialize the pane) as needed. That is typically done by storing some information in the SerializationId of the ContentPane that you parse/use during this event to know how to prepare the pane (e.g. it might be the name of a file if you wanted to reload a document, etc.).
The only part of the other post which appeared unresolved was that that particular customer wanted to use their own derived ContentPane class when they loaded the layout. At that time the NewPane property of the InitializePaneContent's event args was read-only but that was since changed to be a read-write property (probably as a result of the issue submitted to support about that post).