I have a XamDockManager control with MDI-style ContentPanes. My tabs are bound. I am using Attached Properties to manage the tabs. I am using using Dependency Properties to handle loading and saving the layout.
On start up everything works as expected. My problem starts when I tear off one of my previously tabbed panes. SaveLayout() work correctly. If I shut down the app and restart it the load fails during xamDockManager.LoadLayout(path_to_saved_layout).
"Specified element is already the logical child of another element. Disconnect it first."
If I leave all of my bound, MDI-style panes as-is on start-up, there are no problems reloading the layout original layout. Tearing off non-bound panes, doesn't cause any problems either.
Any suggestions on how to get around this problem while still allowing my users the ability to save their custom layouts?
HI,
I am just following up on this form thread.
Please let me know if I can provide further assistance.
Sincerely,
Matt Developer Support Engineer
I've got a working solution at this point. The "trick" was writing a utility to walk the visual tree to find all of the XamDockManagers by type. That resolved many of my concerns and allowed for the separation we wanted.
I can watch the MainWindow closing event through Applicaiton.Current.MainWindow. I used an attached property to wire that up.
I added a dependency property bound to my view model to manage the layout filename. That resolved my concern for multiple dock managers within the same app. It also resolves the code reuse issues by not hardcoding the layout filename in the assembly. It's set in the viewmodel context.
I still need to a couple assemblies and write more tests but at this point everything is working. I'm marking the issue as resolved.
Thx,
Ivan
Do you have a main ContentPane, if you do, you could wire up that pane's closing event.
In that event , you could save your layout.
Here is a help link: http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=InfragisticsWPF4.DockManager.v10.3~Infragistics.Windows.DockManager.ContentPane_members.html
Sincerely. Matt Developer Support Engineer
Hi Matt,
We're still moving pieces around the board so to speak.
I have left my current SaveLayout() operations in their previous locations (which I dislike). The goal is to have our dock manager systems as a plug-in play framework item for the development team. With that in mind, we have to allow for a situation where two dock managers could exist side-by-side, say on a single grid with each XamDockManager in separate columns. In this situation, the developer would have to know more about the underpinning of the module than we'd like.
As it is, I'm thrashing the disk saving the layout every time it changes. I'm still looking for a single exit event within the XamDockManager context that would allow me to save the layout once and only once during the app lifetime.
Any suggestions?
I am just following up on this tread.
Please let me know if you need further assistance regarding this issue.
Sincerely, Matt Developer Support Engineer