How to Get the docksite for the viewmodel

Docking/MDI for WPF Forum

Posted 8 years ago by keshav bansal
Version: 12.1.0560
Avatar

Hi,

I am able to register the view as the toolwindow in main application by adding the viewmodel into the region as in case of the prism integration with docking.

How to Get the docksite for the object of the viewmodel.

during the runtime if i get the breakpoint in the viewmodel then i can check the viewmodel exists in which docksite by using  the quickWatch (debug time).

But programatically not geting..

 

ForExample:

My view is exist in the docksite1 and if i close the button in the docksite3 ,it closes that view of the docksite1 but if i move the view from the docksite1 to any another docksite2 and then click the close button of the docksite3 then now  how to get the view or the viewmodel exists in the docksite2 indstead of docksite1.

Comments (3)

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

Hi Keshav,
There is a DockSite.GetDockSite method that checks for an attached property on the object passed to it and returns the closest ancestor DockSite. You could try using this on the view.


Actipro Software Support

Posted 3 years ago by Stefan Koell
Avatar

Hi,

I'm trying the same thing but in my case I cannot find the DockSite.GetDockSite method. Am I missing something? Did the API change?

Regards,
Stefan

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

Hi Stefan,

Yes that was in the old API, which used a lot of inherited properties but we've done away with those in the new 2016.1 version since they weren't performant. 

If you have a view, you can get the ancestor DockingWindow of it (such as via our VisualTreeHelperExtended.GetAncestor<DockingWindow>() method) and then the DockSite will be a property off of that.  That would effectively do the same as what the old DockSite.GetDockSite(view) method would have done.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) 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.