Unexpected docking behavior after adding tool window to existing AutoHide-Group

Docking/MDI for WPF Forum

Posted 9 years ago by Stefan Link
Version: 15.1.0623
Platform: .NET 4.5
Environment: Windows 7 (64-bit)
Avatar

We discovered some unexpected behavior when adding a new tool window to an existing AutoHide-Group.

Sample Code (new WPF project):

MainWindow.xaml:

<DockPanel>

        <Button DockPanel.Dock="Bottom" Content="Add" Click="ButtonBase_OnClick" />

        <docking:DockSite x:Name="DockSite" />

</DockPanel>

 

MainWindow.xaml.cs:

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

            new ToolWindow(DockSite) {Title = "Tool"}.AutoHide(Dock.Left);
        }

        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            new ToolWindow(DockSite) {Title = "Tool2"}.Dock(DockSite.ToolWindows[0], Direction.Content);
        }
    }

 When running this sample, clicking the Add-button and then the "Auto Hide"-Pin to dock the two tool windows works as we'd expect it.

-> Both tool windows are displayed within the same container.

 

But the following steps produce an unexpected situation:

  1. Start the sample
  2. dock the first tool window (by clicking the "Auto Hide"-Pin)
  3. hide the window again (clicking "Auto Hide"-Pin again)
  4. Add the second tool window with the Add-button
  5. now dock the second tool window (by clicking the "Auto Hide"-Pin)

-> The two tool windows are displayed side-by-side, not within the same container.

 

Is this a bug or is something important missing?

 

Thanks in advance

Stefan

Comments (1)

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

Hi Stefan,

I believe what's happening is that when you do #2/#3, you leave a "track" (breadcrumb) behind for that particular tool window.  Later in #5, it is running through each tool window to see if any "tracks" are found.  If so, it restores to that location.  At the point of #5, the one window replaces a track.  The other window doesn't yet have a track so it goes to a default location. 

In the code for vNext (see our blog for details on vNext), we've completely rewritten all this logic and it will keep the windows in the same container together and will not split them up as in this scenario.

[Modified 9 years ago]


Actipro Software Support

The latest build of this product (v24.1.2) was released 0 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.