This project is read-only.

[Version 2.0] Docking as Tabbed Document

Aug 9, 2012 at 2:05 AM


I am currently suffering from a problem with the document pane that the samples are experiencing as-well. I'll try and explain the steps to reproduce it as best I can.


If you run the 'AvalonDock.TestApp' and you dock the 'Tool Window 1' as a Tabbed Document; by either by dragging into the Document Pane or clicking the context menu and selecting "Dock as Tabbed Document". AvalonDock should behave appropriately by moving the floating window or anchorable item into the tabbed documents pane. Now, if you click the 'x' to close the 'Tool Window 1' from the tabbed documents pane and you attempt to re-open it via. 'Tools>Tools Window 1' Linq will throw a exception stating:

System.InvalidOperationException - Sequence contains no matching element


Here (MainWindow.xaml.cs):

private void OnShowToolWindow1(object sender, RoutedEventArgs e)
    var toolWindow1 = dockManager.Layout.Descendents().OfType<LayoutAnchorable>().Single(a => a.ContentId == "toolWindow1");
    if (toolWindow1.IsHidden)
    else if (toolWindow1.IsVisible)
        toolWindow1.IsActive = true;
        toolWindow1.AddToLayout(dockManager, AnchorableShowStrategy.Bottom | AnchorableShowStrategy.Most);


The 'AvalonDock.MVVMTestApp' has a slightly similar problem. If I run the application and dock the 'File Stats' anchorable window by either dragging into the Tabbed Documents area or using the context menu to select "Dock as Tabbed Document", it will behave appropriately. I can then use 'Tools > File Stats' menu option to toggle the display of window. However, if i use the "x" to close the window and attempt to re-open it using the 'Tools > File Stats' window, I will not see it ever again.


I basically would like to handle this appropriately, is there anything I should do? I also like would like to handle menu items like like the 'AvalonDock.TestApp' method. I like the ability to make the anchorable pane or document active if it is already visible.

Jan 5, 2013 at 12:01 PM
Edited Jan 5, 2013 at 12:03 PM


Refering to the closing of 'File Stats', in the case of [Version 2.0] MVVMTestApp, I have a solution. It involves the method void IOverlayWindow.DragEnter(IDropArea area) in AvalonDock.Controls.OverlayWindow.cs.

if area.Type == DropAreaType.DocumentPane AND isDraggingAnchorables() then areaElement = _gridDocumentPaneFullDropTargets.

Hey what about  areaElement = _gridAnchorablePaneFullDropTargets ?

If you think this is meaningful, post a reply.

Jan 14, 2014 at 10:10 PM
I couldn't manage to get your solution to work, so I tried by myself.
My answer is here
Jan 14, 2014 at 11:40 PM
Hey phbarralis, this issue has been resolved by the adospace awhile ago. It appears to be different what you are trying (or did) do. However, I do like the ability to turn off docking as a tabbed document, so I may investigate what you have done, and apply a way to turn it off and on dynamically. I'll let you know if I come up with anything.