Following is a code-snippet I use to find the SplitContainer & Window Group of a given DockableWindow. You can easily moidify it not to return but to complete the traversal for finding windows. Also, you would require to iterate over the WindowGroup items to get all the unpinned windows as well.
private WindowPropertyContainer GetWindowProperties(DockableWindow _window)
{
Debug.Assert(null != _window, "null == _window.");
if (_window.DockSite != null && _window.DockSite.SplitContainers != null)
{
for (int i = 0; i < _window.DockSite.SplitContainers.Count; ++i)
{
SplitContainer splitContainer = _window.DockSite.SplitContainers;
if (splitContainer != null)
{
WindowPropertyContainer container = this.GetWindowProperties(splitContainer, _window);
if (!container.IsEmpty)
{
return container;
}
}
}
}
return WindowPropertyContainer.Empty;
}
private WindowPropertyContainer GetWindowProperties(SplitContainer splitContainer_, DockableWindow _window)
{
if (splitContainer_ != null)
{
for (int i = 0; i < splitContainer_.Children.Count; ++i)
{
FrameworkElement element = splitContainer_.Children;
if (element != null)
{
if (element is WindowGroup)
{
WindowGroup windowGroup = element as WindowGroup;
if (windowGroup != null)
{
if (windowGroup.SelectedWindow == _window || windowGroup.Items.Contains(_window))
{
return new WindowPropertyContainer(splitContainer_, windowGroup);
}
}
}
else if (element is SplitContainer)
{
SplitContainer splitContainer = element as SplitContainer;
WindowPropertyContainer container = this.GetWindowProperties(splitContainer);
if (!container.IsEmpty)
{
return container;
}
}
else
{
Debug.Fail("Unexpected type: " + element.GetType().FullName);
}
}
}
}
return WindowPropertyContainer.Empty;
}