This project is read-only.

Setting panel state at form load time

Oct 19, 2009 at 8:20 AM

I'm trying to set the initial state of a panel to AutoHide (i.e. set it at form load time), I see there's a DockableContent.State property but this is read only. I've been rooting aroud trying to find an appropriate looking attached property, with no luck.

Any ideas on how to do this?

Thanks.

Oct 19, 2009 at 11:45 AM

I just hit the same problem.

You can name the DockingManager and the DockablePanel and then, on Loaded event, you can call something like this:

uxDockingManager.ToggleAutoHide(uxLogPane);

Don't try that in the constructor of your page :)

Oct 20, 2009 at 3:42 PM

Have the same problem. I not sure about solution provided by claus_pcc,: the avalon dock supports saving and restoring layout (including dockable's states) - setting state of dockable manually after startup will override and thus corrupt the saved layout...

Should be some way to specify "defaut" state of the dockable.

Nov 6, 2009 at 4:17 AM

private void Window_Loaded(object sender, RoutedEventArgs e)
{
   ShowWindow(this._setupWindow, DockableContentState.AutoHide);
}

void ShowWindow(DockableContent contentToShow, DockableContentState desideredState)
{
   if (desideredState == DockableContentState.AutoHide ||
      desideredState == DockableContentState.FloatingWindow)
   {
      this._dockingManager.Show(contentToShow, desideredState);
   }
   else
      this._dockingManager.Show(contentToShow, DockableContentState.Docked);
}

Where _dockingManager and _setupWindow are names defined in the xaml code