4

I'm using AvalonDock 2.0

I feel that it's supposed to be pretty basic but the documentation doesn't say a thing and I've played around for 2 hours to try and figure it out. So, I'm sorry if this is too simple.

I want exactly what the title says. The documentation mentions how to make a bottom side panel but only an auto-hidden one, which is not what I want.

I tried to toggle it's autohide in code-behind but the height wasn't affected so every single time the application starts the user has to drag it up to see the panel's content.

Sheridan
  • 68,826
  • 24
  • 143
  • 183
MasterMastic
  • 20,711
  • 12
  • 68
  • 90

2 Answers2

4

A bit hacky but this worked for me:

    <xcad:DockingManager x:Name="DockingManager" Grid.Row="1" DocumentsSource="{Binding Documents}" Loaded="DockingManager_OnLoaded">
        <xcad:LayoutRoot>
            <xcad:LayoutPanel Orientation="Horizontal">
                <xcad:LayoutDocumentPane></xcad:LayoutDocumentPane>
                <xcad:LayoutAnchorablePane DockWidth="Auto" SelectedContentIndex="0">
                    <xcad:LayoutAnchorable Title="Right">
                        <Label>Right</Label>
                    </xcad:LayoutAnchorable>
                </xcad:LayoutAnchorablePane>
            </xcad:LayoutPanel>
            <xcad:LayoutRoot.BottomSide>
                <xcad:LayoutAnchorSide>
                    <xcad:LayoutAnchorGroup>
                        <xcad:LayoutAnchorable x:Name="OutputAnchorable" Title="Output">
                            <Label>Bottom</Label>
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorGroup>
                </xcad:LayoutAnchorSide>
            </xcad:LayoutRoot.BottomSide>
        </xcad:LayoutRoot>
    </xcad:DockingManager>

Then in the code behind:

    private void DockingManager_OnLoaded(object sender, RoutedEventArgs e)
    {
        OutputAnchorable.ToggleAutoHide();

        // You might want to do this to get a reasonable height
        var root = (LayoutAnchorablePane)OutputAnchorable.Parent;
        root.DockHeight = new GridLength(100);
    }
jmcg
  • 357
  • 3
  • 12
  • Also works in AvalonDock 3.5 without the code behind part https://github.com/Dirkster99/AvalonDock/blob/master/source/TestApp/MainWindow.xaml – user8276908 May 09 '19 at 16:05
  • @user8276908 Apparently it doesn't, at least I was not able to get it to work. The sample markup you linked still automatically hides the `LayoutAnchorable` for me. – Carsten Jan 16 '20 at 13:21
  • @Carsten Thats really strange, there are sample [apps](https://github.com/Dirkster99/AvalonDock/wiki/WPF-VS-2013-Dark-Light-Demo-Client) in that repository where you can load and save layouts including hidden ´LayoutAnchorables´. But maybe I go the requirements wrong and you actually need an (interactive solution](https://github.com/Dirkster99/AvalonDock/issues/145), if yes, I am the maintainer, maybe we should do a command binding to make it easy (as suggested in the issue). It goes faster if someone submits a working PR :-) – user8276908 May 06 '20 at 20:43
  • I see now this is not about Hidden panels so the referenced apps link shold give you a working example for it (period). I just cannot edit my comment anymore so forget about the 2nd part of my comment :-( – user8276908 May 06 '20 at 20:51
3

You need something like this

<xcad:LayoutPanel Orientation="Vertical">
                <xcad:LayoutPanel Orientation="Horizontal"  >   


</xcad:LayoutPanel>
</xcad:LayoutPanel>

The second layout will create all the mix panels, the first will create the top or bottom in vertical way

hegarcia
  • 31
  • 6