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
Avatar

Hi,

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
  .Select(GetLogicalAncestor<TabbedMdiContainer>)
  .Where(m => m.HasValue)
  .Select(m => m.Value)
  .Distinct()
  .ToList();
 
var selectedWindows = tabbedMdiContainers.Select(c => c.SelectedWindow).Where(c => c != null).ToList();

 Is there a better way?

Many thanks!

Paul

Comments (2)

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

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
Avatar

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.1) 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.