Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1485
"Locking" the layout
posted

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

Parents
  • 54937
    Offline posted

    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.

Reply Children
No Data