Detecting whether a window is floated

Docking/MDI for WPF Forum

Posted 8 years ago by Martin Votruba
Version: 17.1.0651
Avatar

I have layout based on MVVM. My views are genereted accord to the propriet DataTemplate. My Documents can be floated. What I would like to do is alter the View based on whether the document is hosted inside of the main host or some of the floating host. Best way would be to create property inside my ViewModel (e.g. IsFloted) and bind that property to the document property (simmilary to IsOpen, IsActive...), but there is non such property on DockingWindow. Can you suggest any solution?

 

Thank you,

Martin

Comments (8)

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

Hi Martin,

We don't have anything MVVM-friendly for floating just yet.  That is something we want to investigate further though.  Right now you have to call methods like Float() to float the docking windows. 

You would like to be able to toggle IsFloating from your VM?  How would you like to determine where it floats to when that property would be set to true?


Actipro Software Support

Posted 8 years ago by Matthew Bristow
Avatar

I've been needing a simialr feature where I am undocking and floating a ToolWindow to the size of my TabbedMdiContainer, and then the ability to redock.

I ran into a few issues with identifying the state myself.

I can't remember what states I was looking at but, probaly looked at them all but I believe the ToolWindowContainer.State stated it was docked, even though it was floating. So that was no use use to me.

My next thought was to have a simple bool attached property. I was using this with triggers to update the value but when you floated, the state of the attached property was lost transitioning between dock to float, in that the docked version had the changed state but the floating did not.

What I have now (that admitidely feels rather dirty) is to modify the default style by adding in a number of RoutedEventTrigger's that I then InvokeCommandAction to my ViewModel where I simply flip a bool when the command comes in, and I have a number of bindings based of my property to determine what state it is in.

And even then it isn't exactly what I need...

[Modified 8 years ago]

Posted 8 years ago by Matthew Bristow
Avatar

Just in case someone else stumbles here.

You can do the following check to see if it is floating, I've used this inside of an attached behaviour.

window.DockHost != window.DockSite.PrimaryDockHost
Posted 8 years ago by Martin Votruba
Avatar

That sounds like something that could solve my problem as well. Could you please elaborate your solution a bit more? My intention was to subsribe for PropertyChange event of the DocumentWindow, then check for changes of DockHost and set a atteched property as you proposed. The only problem is that DocumentWindow is not notyfing you for changes of the DockHost, so it does not work...

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

Hi all,

If we added some sort of DockingWindow.IsFloating property, it sounds like that might help a lot, right?  It would effectively return if the docking window was in a floating dock host.  And setting it would float/dock the docking window as long as it was already open.  It would ideally be bindable so that you could tie it to your VM.  What would it return if the docking window was floating but closed temporarily... should it be IsFloating=true and IsOpen=false in that case?

Thoughts?


Actipro Software Support

Posted 7 years ago by Martin Votruba
Avatar

Yes, to have a DockingWindow.IsFloating property would help me, I do not need to set it programmaticly, just observe. In my app I have a toolbar in the main window, which is controling the one active window at the time. But when the window gets floated, I would like to put the toolbar into the opened window. I might as well modifie the template od DockingHost, if my thinking is right, but that seems as to much hassle.

Do you have any estimates, when this new property could be implemented?

 

Thank you.

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

Hi Martin,

I don't think I'd recommend altering the DockHost template.  But you could put the toolbar in your DockingWindow content itself.

The property has been implemented and is slated to roll out for the 2017.2 version.  We hope to launch the last 2017.1 maintenance release in the next week or so and then work on getting 2017.2 prepped and rolled out shortly after since we have a number of updates ready for 2017.2.


Actipro Software Support

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

Hi Martin,

We have a preview build of the 2017.2 version uploaded if you would like to help beta test the new feature.  Please write our support address if so.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.