Always float a new tool window?

Docking/MDI for WPF Forum

Posted 8 years ago by Gareth Parris - Software Developer, McLaren
Version: 16.1.0635

Is there a simple way to always float a new tool window, intead of docking it and floating afterwards?

We have a new user requirement to optionally allow new tool windows to do this and the only way I can see is to intercept the

protected override void OnWindowsOpened(DockingWindowsEventArgs eventArgs)

 method and call .Float() based on my criteria.

Or possibly we thought we could use something this

protected override void OnWindowDefaultLocationRequested(DockingWindowDefaultLocationEventArgs e)

  if (e.Window.Description == ToolWindowType)

 but that doesn't work as the window isn't yet displayed. Is there a better way to do it?

[Modified 8 years ago]

Comments (5)

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

Hi Gareth,

In a non-MVVM scenario, you would just create the tool window and call Float() on it.  But I believe you are in a MVVM scenario, and there isn't a great place to designate a floating window yet.

It seems like we'd need to add something to allow a WindowDefaultLocationRequested event handler to specify that a docking window should be floated and to where.  New options would need to be added to DockingWindowDefaultLocationEventArgs.  Maybe these:

  • bool ShouldFloat - defaults to false
  • Point? FloatLocation - defaults to null
  • Size? FloatSize - defaults to null

Would that meet your needs?  If you set e.ShouldFloat to true, would that take precedence over an e.Target that you set, or not?

Actipro Software Support

Posted 8 years ago by Gareth Parris - Software Developer, McLaren

That could work for us. We don't tend to set the e.Target anywhere programmatically at present so I would say yes it does take precedence.

Posted 7 years ago by Reed Copsey

If these are new arguments to an EventArgs (WindowDefaultLocationRequested), why not pre-populate them with the expected location?  That'd let us override them, but also inspect if we wanted, and eliminated the nullable types.

From an MVVM scenario, it does seem like just having these as Dependency Properties would be nice, as well.  They can always default to DependencyProperty.UnsetValue if the user hasn't bound them.

Posted 7 years ago by Matthew Bristow

I conquer with Reed's statments.

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA

For the upcoming 2017.2 version, we've implemented an e.ShouldFloat property for the DockSite.WindowDefaultLocationRequested event.  Then the FloatingWindowOpening event can be used to customize its size.

We also have added a DockingWindow.IsFloating property that can be bound to for MVVM usage.

If you'd like to help beta test these features, please write us.

Actipro Software Support

The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.