Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a bottom panel without auto-hide using AvalonDock 2.0?

Tags:

c#

wpf

avalondock

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.

like image 753
MasterMastic Avatar asked Mar 23 '23 23:03

MasterMastic


2 Answers

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);
    }
like image 181
jmcg Avatar answered Apr 03 '23 04:04

jmcg


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

like image 34
hegarcia Avatar answered Apr 03 '23 04:04

hegarcia