Dirkster99 / AvalonDock

Our own development branch of the well known WPF document docking library
Microsoft Public License
1.41k stars 320 forks source link

Using Auto for DockHeight #298

Open EtienneLaneville opened 3 years ago

EtienneLaneville commented 3 years ago

Using Auto for DockHeight on a LayoutAnchorablePane works some of the time when editing the XAML in Visual Studio but doesn't work at run time. Here's a simple example that demonstrates the problem:

<Window x:Class="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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:avalonDock="clr-namespace:AvalonDock;assembly=AvalonDock"
        xmlns:avalonDockLayout="clr-namespace:AvalonDock.Layout;assembly=AvalonDock"
        xmlns:local="clr-namespace:AutoDockHeightTest"
        mc:Ignorable="d"
        Title="Auto Dock Height"
        Height="450"
        Width="800">
    <Grid>

        <avalonDock:DockingManager x:Name="dockingManager"
                                   AllowMixedOrientation="True">

            <avalonDockLayout:LayoutRoot x:Name="layoutRoot">

                <avalonDockLayout:LayoutPanel x:Name="mainLayoutPanel"
                                              Orientation="Vertical">

                    <avalonDockLayout:LayoutAnchorablePane DockHeight="Auto"
                                                           Name="autoSizePane">
                        <avalonDockLayout:LayoutAnchorable Title="Auto Size">
                            <Border Background="Aquamarine">
                                <Expander Header="Auto Size Anchorable">
                                    <Border Background="Fuchsia"
                                            Height="100">
                                        <TextBlock Text="Hidden content" />
                                    </Border>
                                </Expander>
                            </Border>
                        </avalonDockLayout:LayoutAnchorable>
                    </avalonDockLayout:LayoutAnchorablePane>

                    <avalonDockLayout:LayoutAnchorablePane DockHeight="*"
                                                           Name="relativeSizePane">
                        <avalonDockLayout:LayoutAnchorable Title="Relative Size">
                            <Border Background="Aquamarine">
                                <TextBlock Text="Relative Size Anchorable" />
                            </Border>
                        </avalonDockLayout:LayoutAnchorable>
                    </avalonDockLayout:LayoutAnchorablePane>

                </avalonDockLayout:LayoutPanel>
            </avalonDockLayout:LayoutRoot>
        </avalonDock:DockingManager>

    </Grid>
</Window>

This is how the Window shows up in Visual Studio:

image

When you run the project though, the Window shows up like this:

image

mattico commented 2 years ago

See: https://github.com/xceedsoftware/wpftoolkit/pull/1195 And https://github.com/Dirkster99/AvalonDock/issues/73