Why do AvalonDock panes collapse in height when splitters first moved?

C#, WPF, AvalonDock v 4.0.0.0. I have got three AnchorablePanes arranged vertically within a LayoutPanel. When either splitter is first adjusted by the user, all three AnchorablePanes abruptly change in height or vertical position. As far as I can see, what is happening this:

When a splitter is moved, the furthest AnchorablePane (i.e. the one that should be unaffected by the move) collapses to its minimum height. The remaining two adjust to fill the space, retaining the correct height ratios relative to one another. i.e.

If the top splitter is moved, AnchorablePane 3 collapses and AnchorablePanes 1 and 2 expand to fill the space.

If the bottom splitter is moved, AnchorablePane 1 collapses and AnchorablePanes 2 and 3 expand to fill the space.

The AnchorablePanes do not just collapse to fit the contents. In my real application they do have content, which gets obscured.

enter image description here

Once this has happened, behavior thereafter is normal. It is as if the initial display does not match the underlying parameters, so the first time it gets recomputed there is a correction.

Do we know what causes this or how to prevent it? The following minimal example demonstrates. Just run this and move either of the splitters.

 <Window x:Class="TestAvalon.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:dock="http://schemas.xceed.com/wpf/xaml/avalondock"
          Title="MainWindow" Height="450" Width="800">
      <Grid>
          <dock:DockingManager x:Name = "Dockman">
              <dock:LayoutRoot x:Name = "_layoutRoot" >
                  <dock:LayoutPanel Orientation="Vertical">
                      <dock:LayoutAnchorablePaneGroup Orientation="Vertical">
                          <dock:LayoutAnchorablePane>
                              <dock:LayoutAnchorable Title = "TEST PANE 1">
                              </dock:LayoutAnchorable >
                          </dock:LayoutAnchorablePane >
                          <dock:LayoutAnchorablePane>
                              <dock:LayoutAnchorable Title = "TEST PANE 2">
                              </dock:LayoutAnchorable >
                          </dock:LayoutAnchorablePane >
                          <dock:LayoutAnchorablePane>
                              <dock:LayoutAnchorable Title = "TEST PANE 3">
                              </dock:LayoutAnchorable >
                          </dock:LayoutAnchorablePane >
                      </dock:LayoutAnchorablePaneGroup>
                  </dock:LayoutPanel>
              </dock:LayoutRoot >
          </dock:DockingManager>
      </Grid>
  </Window>

using System.Windows;

namespace TestAvalon
{

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

    }
}

Answer

Although I don’t know what was causing this behavior, or how to avoid it when using Xceed’s AvalonDock, I have got around the problem by using Dirkster’s AvalonDock fork. I am using version 4.50.2, and only minimal changes to code were required in order to switch between the two libraries. Dirkster’s AvalonDock does not exhibit the problem behavior described in the question.

Leave a Reply

Your email address will not be published. Required fields are marked *