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

☆樱花仙子☆ 提交于 2019-12-23 14:54:31

问题


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.


回答1:


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);
    }



回答2:


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



来源:https://stackoverflow.com/questions/17972491/how-to-create-a-bottom-panel-without-auto-hide-using-avalondock-2-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!