How to use LinkDockSite for nested DockSite

Docking/MDI for WPF Forum

Posted 2 years ago by Yuki
Version: 22.1.3
Avatar

Hello,

How to use LinkDockSite for nested DockSite?

Source code is below.

MainWindow.xaml

<Window
    x:Class="LinkedDockSiteSample.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    xmlns:local="clr-namespace:LinkedDockSiteSample"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MainWindow"
    mc:Ignorable="d">
    <Grid>
        <!--  DockSite1  -->
        <docking:DockSite x:Name="DockSite1">
            <docking:SplitContainer>
                <docking:SplitContainer>
                    <docking:ToolWindowContainer>
                        <docking:ToolWindow Title="Tool Window 1" />
                        <docking:ToolWindow Title="Tool Window 2" />
                    </docking:ToolWindowContainer>
                </docking:SplitContainer>

                <docking:Workspace>
                    <docking:ToolWindowContainer>
                        <docking:ToolWindow
                            Title="Fixed"
                            CanDragTab="False"
                            HasTitleBar="False">

                            <!--  DockSite2  -->
                            <docking:DockSite x:Name="DockSite2" IsHitTestVisible="True">
                                <docking:Workspace>
                                    <docking:TabbedMdiHost>
                                        <docking:TabbedMdiContainer>
                                            <docking:DocumentWindow Title="Document1.txt">
                                                <TextBox
                                                    BorderThickness="0"
                                                    Text="Move other tool windows around the 'fixed' tool window."
                                                    TextWrapping="Wrap" />
                                            </docking:DocumentWindow>
                                        </docking:TabbedMdiContainer>
                                    </docking:TabbedMdiHost>
                                </docking:Workspace>
                            </docking:DockSite>
                        </docking:ToolWindow>
                    </docking:ToolWindowContainer>
                </docking:Workspace>
            </docking:SplitContainer>
        </docking:DockSite>
    </Grid>
</Window>

MainWindow.xaml.cs

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            DockSite1.LinkDockSite(DockSite2);
        }
    }

Comments (2)

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

Hello,

The code above has an invalid docking hierarchy.  ToolWindowContainers must be outside of a workspace, and you should remove the ToolWindowContainer and ToolWindow that are direct children of the Workspace and have the nested DockSite as the Workspace child.

Regardless, linked nested dock sites are not supported.  Many bad situations could occur in that scenario, such as if a document in the outer dock site contained the inner dock site, and you dragged that document into the inner dock site.  That being said, dock sites that are NOT nested can be linked fine, and that scenario is demoed in our related QuickStart sample.


Actipro Software Support

Posted 2 years ago by Yuki
Avatar

Thanks.

I understood linked nested DockSite is not supported.

The latest build of this product (v24.1.3) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.