How to close a floating dockhost?

Docking/MDI for WPF Forum

Posted 2 years ago by Brian Pratt
Version: 16.1.0635
Avatar

When I load the DockSite from a memorystream, there are some FloatingDockHosts that I want to remove (they should not be there from older designs).

DockSite.FloatingDockHosts gives me the list of items I want to remove (where the Title is empty), but I cannot for the life of me figure out how to close those things.

How can I close items that are in the DockHost.FloatingDockHosts (they are a list of DockHosts, TabbedMDIHosts) ?

foreach(var fdh in _DockSite.FloatingDockHosts.Where(x => x.Title == ""))
{
   // how to close this floating dock host?
}

 

Thanks,

Brian

[Modified 2 years ago]

Comments (4)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Brian,

If you are running the latest 2016.1 build 635 maintenance release (I believe there were some issues with this in the older builds) it shouldn't be showing any floating dock hosts if they are empty.  To close them, you would close all the docking windows within them. 

Are you running build 635 and do you see the problem in that?  If so, please put together a new simple sample project that shows it happening and email that to our support address so we can debug with it.  Reference this thread in your email and be sure to rename the .zip file extension of anything you send so it doesn't get spam blocked.  Thanks!


Actipro Software Support

Posted 2 years ago by Brian Pratt
Avatar

Yes, I have the latest version.  I've not yet tried to isolate the problem.  I'll see what I can do.

I thought I might have it using the FloatingWindowOpening event, but I still cant figure out how to close or stop the window from opening... e.Handled still lets the window open (I'm looking for tab hosts that have null children)

 

    void _DockSite_FloatingWindowOpening(object sender, FloatingWindowOpeningEventArgs e)
    {
      var dhc = e.DockHostChild as Workspace;
      if (dhc != null)
      {
        var ch = (dhc.Content as TabbedMdiHost);
        if (ch != null)
        {
          if (ch.Child == null)
          {
            // dont open an orphaned window
            e.Handled = true; // ??  THIS STILL LETS WINDOWS OPEN!!
          }
        }
      }
    }
Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Brian,

There shouldn't be any floating dock hosts opening at all that don't have at least one docking window in them.  If you are seeing that, then that is a scenario-based bug that we'd need to fix.  That's why I requested the simple sample sent to our support address.  Thanks for working on that.

FloatingWindowOpening is only for initializing the Window size, and it doesn't have features to block a docking window from floating.


Actipro Software Support

Posted 2 years ago by Brian Pratt
Avatar

I've submitted a sample project to support.

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.