TabbedMdiHost: Is it possible to get a notification if the user sorts the documents with drag&drop?

Docking/MDI for WPF Forum

The latest build of this product (v2019.1 build 0682) was released 27 days ago, which was before this thread was created.
Posted 25 days ago by Steven H.
Version: 16.1.0636


we are using to TabbedMdiHost to visualize document pages which are (always opened) as tabs.

So we would like to enable the user to sort these tabs manually via drag & drop and reflect these order in our internal models too.

Is there a event or something like that we can catch to get notifed when the order document of the documents has been changed?

Actually we didn't found anything like that, but we saw that the contained DockSite.Documents collection reflects these changes.

Is there any way to get a notification after the document has been dragged or the Documents collection was changed?

Thank you.

Comments (3)

Posted 25 days ago by Actipro Software Support - Cleveland, OH, USA


There is a DockSite.WindowsDragged event that fires after any drag occurs.  This fires when tool or document windows are dragged anywhere, but you could check the DockSite.Documents collection to see if anything changed.

I believe the collection returned by DockSite.Documents also has a CollectionChanged event you could probably watch.

Actipro Software Support

Posted 24 days ago by Steven H.


thanks for your reply.

I've already tried both ways you've mentioned, but DockSite.Documents doesn't seem to fire a CollectionChanged event (even not when adding or removing tabs).

The DockSite.WindowsDragged event also doesn't fire when only sorting the tabs.

It seems that it's only get called when i try to drag a tab out of the tab control, but not when i re-order the tabs.

Dragging out tabs is disabled in our case.

Posted 24 days ago by Actipro Software Support - Cleveland, OH, USA

Hi Steven,

Ahh, I see.  Yes when you just reorder tabs in the same docking window container, the normal drag logic never executes and thus the WindowsDragged event won't fire for that scenario.  We are making updates for the next build to fire WindowsDragging/WindowsDragged events right after a same-container tab reorder occurs.  That way in the next build, you can reliably use the WindowsDragged event for all scenarios to know when a tab moves due to drag/reorder or drag elsewhere.

The collection returned by DockSite.Documents is a ReadOnlyObservableCollection<DockingWindow>.  Upon looking further at ReadOnlyObservableCollection<T>, it appears that their CollectionChanged event is "protected" access.

Actipro Software Support

Add Comment

Please log in to a validated account to post comments.