I'm just starting with the XamDockManager, so hopefully I'm not asking the obvious here. Is there any way to "lock" the layout? For example, let's say the user has the layout just like he wants, and wants to make sure he doesn't move things around by mistake (so easy to do... - e.g. double-click a title bar by mistake and suddenly the pane is floatong.) Essentially I'd like to be able to prevent people from moving/docking/whatever the panes - lock them all in place, but also I want the option of letting them revert to the normal behaviour of the dock manager (a setting would allow them to lock/unlock at will.)
Thanks,Michel
There is currently no single property that would disable all customization of the layout. There are properties on the ContentPane clas for allowing/disallowing all the various actions (AllowDocking, AllowPinning, etc.) and there are events raised as actions are about to occur. So there are a couple of things you could do. You could store the "unlocked" values for all of these properties on each pane when you are locking the layout, set all the appropriate allow properties to false, and then restore the saved settings when going back to the unlocked state. There is a GetPanes method on the XamDockManager that will return an enumerator you can use to access all the ContentPanes. If any panes are added programatically while in this unlocked state, you would have to handle initializing them as well.
Another option would be to hook the ExecutingCommand event of each ContentPane and set e.Cancel to true for any command that you don't want the user to be able to perform. All the commands that a ContentPane deals with are defined on the ContentPaneCommands class. In addition, you would probably need to handle the PaneDragStarting and set cancel to true. The downside to this approach would be that the various contentmenu and caption buttons would still be enabled.
You should also submit a feature request for this behavior to be built into the control.
I hooked a handler to ExecutingCommand on ContentPane, but could not get hit for flyin and flyout command.
Thanks Andrew. I gave that a quick try this afternoon, and it more or less works. The little "gizmo" (down arrow on the left of the pin) stays enabled even though it's empty - not a major concern, but it looks weird. I was however able to move a pane around within the split pane that owns it (but not to the document host nor other split panes.) Not sure if there's any way to disable moving the panes (i.e. by dragging them using the title bar) altogether?? I still need to experiment a little bit with various arrangements, to make sure that it otherwise does what I want.