Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
367 views
in Technique[技术] by (71.8m points)

c# - 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();
        }

    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...