This project is read-only.

[version 1.3] How to re-use a DockablePane?

Aug 27, 2012 at 7:08 AM

(The exact same question on Stackoverflow here: http://stackoverflow.com/questions/12121633/avalondock-how-to-re-use-a-dockablepane)

 

I've just started working on a project where I believed AvalonDock would solve all my docking behavior needs. It sure looks fine but there's one nut I can't seem to crack:

I have this notion of supporting "named" dockable panes. Clients (plug ins) of my solution should be able to tell my "view manager" (that communicates with AvalonDock) that a certain content should be opened in a certain DockablePane. The names can be anything, like "classes" or "pictures" or whatever makes sense to that particular plug-in.

To allow this I do some housekeeping for DockablePane objects and when a specifiedDockablePane is nut supported I create it dynamically and adds it to my "housekeeper" under the specified name.

The problem is that if the user closes the pane I can't seem to get it back in view. I don't know if theDockingManager is keeping the pane around and I can't seem to find out. My housekeeper might be out of sync when this happens. As a plug-in opens some content into the "pictures" DockablePane(which has been previously closed) everything works fine in memory: I get the DockablePane from my "housekeeper" and I can add a DockableContent to it but nothing shows up on screen!

I've looked pretty much everywhere for an event that would signal a DockablePane gets closed to keep my "housekeeper" synchronized but I've found nothing. I've registered handlers for the Closing and Closed events of the ManagedContent class, and they work as expected, but I cannot find out whatDockablePane such objects is currently contained in, if any (user might have dragged it to anotherDockablePane or maybe it is floating at the time of being closed?).

So I thought the Closing/Closed events of the main DockingManager would probably be fired when one of its managed instances where being closed but those events never seem to fire.

I am indeed new to AvalonDock so it might be I'm complicating things but I would very much appreciate any hints or information on how to support named DockablePane.

Thanks

Sep 9, 2012 at 12:32 PM

Up!