Getting the list of selected DocumentWindows in a DockSite

Docking/MDI for WPF Forum

Posted 9 years ago by Eamon Hetherton
Version: 15.1.0620


I have a DockSite that contains multiple TabbedMdiContainers. How do I get the selected DockingWindow for each TabbedMdiContainer?

Currently I am overriding OnActiveWindowChanged, walking the logical tree to get all TabbedMdiContainers and retrieving the SelectedWindow on each TabbedMdiContainer as follows:

var tabbedMdiContainers = DocumentWindows
  .Where(m => m.HasValue)
  .Select(m => m.Value)
var selectedWindows = tabbedMdiContainers.Select(c => c.SelectedWindow).Where(c => c != null).ToList();

 Is there a better way?

Many thanks!


Comments (2)

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

Hi Paul,

Each DockingWindow has an IsSelected property.  I believe you could do something like DocumentWindows.Where(d => d.IsSelected) to get the selected document windows.

The other way to do it would be start at the TabbedMdiHost and look at its Content property.  That will either be a SplitContainer or a TabbedMdiContainer.  Recurse down the tree until you have gone through all the SplitContainers via their Children property.

Actipro Software Support

Posted 9 years ago by Eamon Hetherton

Thanks a lot! DocumentWindow.IsSelected is exactly what I wanted. I'm really enjoying using your product.

The latest build of this product (v24.1.2) 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.