Forbid DockingManager to show floating Window

Jul 19, 2011 at 3:56 PM

Hi all,

 

First of all thanks for this nice control which can come in handy but is in my opinion not documented enough...

 

Anyway, I'd like to disable possibility to have a floating window. User should be allow to drag the DockableContents and drop them somewhere in the DockingManager, but he cannot leave a Floating window.

 

I found a property in DocumentPane which is IsFloatable, but which prevents the document to be dragged, but it seems like there is no equivalent for DockablePanes... Any insights? Ideally I'd like it to behave this way!

  • If user drags and drop a control in the dockingManager, no problem
  • If he tries to leave it as a floating window, the control should come back to a tabbed appearance

 

Also, I'd like to know what is the close button designed for. I can't find any event fired when I click on it, and moreover it closes an ENTIRE dockablePane while it should just close the current DockableContent.

Moreover, clicking on the cross does not even make the current DockablePane active, I tried overriding it by just force closing the active component, but if it is not active before I click on the cross, it'll not be closed (and the currently active content from another DockablePane will actually be closed)

 

Any ideas? Thanks!

Jul 20, 2011 at 7:41 AM

Hello,

I agree on your opinion about documentation. This been said this is an open source project and you can feel free to write and publish it ...

About the close button, yes it closes the pane and not the current window. I wrote a small patch, may be not the smartest way but not intrusive:

  •   Pane.cs

           public ManagedContent SelectedContentToClose = null;
          
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
          
{
          
...
          
         SelectedContentToClose = e.AddedItems[0] as ManagedContent;


  •  DockablePane:

       public virtual bool Close()
       {
           DockableContent[] cntsToClose = Items.OfType<DockableContent>().ToArray();
           bool res = true;

           if (SelectedContentToClose == null) SelectedContentToClose = (ManagedContent)Items.GetItemAt(0);

           foreach (var cnt in cntsToClose)
           {
               if (cnt == SelectedContentToClose)
               {
                   if (!cnt.Close()) res = false;
                   else SelectedContentToClose = null;
               }
           }

          return res;

       }

Edward from Sofa a wrapper for AvalonDock