Skip to content

CanDockAsTabbedDocument

Dirkster99 edited this page Mar 13, 2020 · 2 revisions

Description

The boolean CanDockAsTabbedDocument property can be used to determine whether LayoutAnchorables and classes inheriting from it can be docked inside the documents pane or not. The following series of screenshots shows the expected behavior when this property is set to false:

The Docked as Tabbed Document docking menu item is dissabled:

The DockingManager offers only docking buttons for the side dockings (left, top, right, bottom) if a LayoutAnchorable is dragged into the documents area (DocumentPane):

The DockingManager overs only docking buttons for the side dockings (left, top, right, bottom) or another LayoutAnchorable (tool window) if a LayoutAnchorable is dragged over another tool window (LayoutAnchorable):

Configuration

There are many different ways to set the CanDockAsTabbedDocument property in a LayoutAnchorable to true. One way to do this is via a custom LayoutInitializer with the following code (see MLibTest client):

public bool BeforeInsertAnchorable(LayoutRoot layout,
                                   LayoutAnchorable anchorableToShow,
                                   ILayoutContainer destinationContainer)
{
    // AD wants to add the anchorable into destinationContainer
    // just for test provide a new anchorablepane 
    // if the pane is floating let the manager go ahead
    LayoutAnchorablePane destPane = destinationContainer as LayoutAnchorablePane;
    if (destinationContainer != null &&
        destinationContainer.FindParent<LayoutFloatingWindow>() != null)
        return false;

    var toolsPane = layout.Descendents().OfType<LayoutAnchorablePane>().FirstOrDefault(d => d.Name == "ToolsPane");
    if (toolsPane != null)
    {
        // do not allow this as Tabbed Document
        anchorableToShow.CanDockAsTabbedDocument = false;
        toolsPane.Children.Add(anchorableToShow);
        return true;
    }

    return false;
}

Demo Projects

Controls

Layout Models

Interfaces

Class Designs

Bugs

Manual Tests

Clone this wiki locally