4

I am having a problem with Avalon Docking where my second panel that's docked at the bottom and set to AutoHide. When UI runs the pane loads as Docked/Visible by default. I would like to have it hidden/minimized.

<ad:DockingManager>
    <ad:ResizingPanel Orientation="Vertical">
        <ad:DocumentPane>
            <ad:DocumentContent>
                <... data grid that fills the view>
            </ad:DocumentContent>
        <ad:DocumentPane>
       <ad:DockablePane>
            <ad:DockableContent Title="output" DockableStyle="AutoHide" IsCloseable="False">
                <...some control>

I have tried various "hacks" suggested on Avalon forums, where OnLoad, you can

outputDockablePane.ToggleAutoHide();

and that works, meaning, when UI is loaded the pane is hidden. However, once you toggle auto hide in .cs code, clicking on the dock header at runtime to make the pane visible/float stops working. So you have to hook up DockingMananger.OnMouseUp() and parse through a couple of boolean states and manually call ToggleAutoHide() - I guess only on the time. Seems like a hack to me.

Here's what I am doing for now, till I find a proper and clean solution:

    private void OnDockManagerLoaded(object sender, RoutedEventArgs e)
    {
        if(_firstTimeLoad && !_isDataGridLoaded)
        {
                outputDockablePane.ToggleAutoHide();
                _forcedToAutoHide = true;
        }
    }

    private void OnDockingManagerMouseUp(object sender, MouseButtonEventArgs e)
    {
        if (_forcedToAutoHide)
        {
            _forcedToAutoHide = false;

            outputDockableContent.Activate();
            outputDockablePane.ToggleAutoHide();
        }
    }

Is there a setting/property that I am totally missing, or/and a better way?

denis morozov
  • 6,236
  • 3
  • 30
  • 45

1 Answers1

0

4 Years still Avalon Docking has the same issue .While I haven't found a proper solution yet , I have tried to refine you workaround logic.

private void OnDockingManagerMouseUp(object sender, MouseButtonEventArgs e)
{
     if (outputDockableContent.IsAutoHidden)
     {
        outputDockableContent.IsActive = false;
     }
}
kiran
  • 1,062
  • 24
  • 31