What is the best way to initialize RadDocking with a saved layout?
I want my application to save layout whenever a RadDocking control is loaded I want to load the saved layout, but I cant find any good event to hook into to run LoadLayout.
I am using Prism with a RegionAdapter as in your ShellPrism sample project.
4 Answers, 1 is accepted
Ok, I realize this was more of a Prism issue than yours. Still I think it might be relevant to you.
I have come up with a solution that works for me. It is the AutoPopuplateRegionBehavior that adds the panes to RadDocking, so I did my own implementation of the behavior that also runs LoadLayout once all panes are added. I override the ConfigureDefaultRegionBehaviors in Bootstrapper to load my own behavior instead of the default AutoPopuplateRegionBehavior.
Thank you for contacting us.
Indeed you can take a look at our "ShellPrism" SDK example available in our GitHub repository here, this example demonstrates the best way of using the RadDocking control with the PRISM library. Regarding your question about when is the best time to load the previously saved layout into the RadDocking, there is no specific event that is the best fit for all scenarios but the one that comes the closest would be the Loaded event of the control.
I created and attached a sample project for you that shows how to save the layout of the control when the application is closed and load it when the application is started. For simplicity the project does not implement any PRISM related behaviors but rather only the required events, hope this is helpful.
Thanks Vladi for reply.
Your sample project does not work for me since it is too early to LoadLayout on the Loaded event. The RadDocking.PanesSource is populated by the RegionAdapter together with AutoPopulateRegionBehavior when my view is loaded, but I need to wait for it to finish before I can do LoadLayout.
I will stick with my solution with the modified AutoPopulateRegionBehavior.
Indeed using the Loaded event could be too early when a full PRISM implementation is does in the context of the RadDocking control.
Thank you for sharing your solution to this case with us. Using the modified AutoPopulateRegionBehavior looks like would be the best fit for the described scenario.