DockSite.CanToolWindowsDock property for LinkDockSite

Docking/MDI for WPF Forum

The latest build of this product (v22.1.4) was released 2 months ago, which was before this thread was created.
Posted 1 month ago by Yuki
Version: 22.1.4
Avatar

Hello,

I'd like to use LinkDockSite as the following.

- DockSite1 : DockSite.CanToolWindowsDock = True

- DockSite2 : DockSite.CanToolWindowsDock = False

Would you please advice how to do it?

My source code is below.

ToolWindow1 can be docked to DockSite2.

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>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        
        <!--  DockSite1  -->
        <docking:DockSite
            x:Name="DockSite1"
            CanToolWindowsAttach="True"
            CanToolWindowsDock="True">
            <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:TabbedMdiHost />
                </docking:Workspace>
            </docking:SplitContainer>
        </docking:DockSite>

        <!--  DockSite2  -->
        <docking:DockSite
            x:Name="DockSite2"
            Grid.Column="1"
            CanToolWindowsAttach="False"
            CanToolWindowsDock="False">
            <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:DocumentWindow Title="Document2.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>
    </Grid>
</Window>


MainWindow.xaml.cs

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

            DockSite1.LinkDockSite(DockSite2);
        }
    }

Comments (2)

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The way the APIs work now is that a property like ToolWindow.CanDock takes top priority and can override default DockSite properties like CanToolWindowsDock.  If the ToolWindow.CanDock property is null, it will use the current owner DockSite's CanToolWindowsDock property value.

In this case, if you have different capabilities for the two dock sites, you might want to leave the default values for all those properties, and then use the feature described in this documentation topic regarding limiting the allowed dock guides while dragging.  That way you have fine grain control over limiting which dock guides show up in a partcular drag scenario.


Actipro Software Support

Posted 1 month ago by Yuki
Avatar

Thanks.

Add Comment

Please log in to a validated account to post comments.