Show/Hide dockable content - how to persist width

Aug 25, 2008 at 8:13 AM
Hi,

I'm trying to write the simple code to show and hide some DockableContent (toggle it's visibility). The name of that element is searchWindow and it is inside a DockablePane, which is inside a ResizingPanel. The DockablePane has the width set through an attached property ad:ResizingPanel.ResizeWidth="210". This is the code I use to toggle the visibility of the DockableContent.

    Public Sub ToggleSearchVisibleCmdExecuted(ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
        If searchWindow.State <> AvalonDock.DockableContentState.Hidden Then
            _dockingManager.Show(searchWindow, AvalonDock.DockableContentState.Hidden)
        Else
            _dockingManager.Show(searchWindow, AvalonDock.DockableContentState.Docked, AvalonDock.AnchorStyle.Left)
        End If
        e.Handled = True
    End Sub

It kind of works like I wanted, but with one minor issue. The width of the DockableContent is now 50% of the DockingManager. How can I fix this?
Aug 25, 2008 at 9:38 AM
Edited Aug 25, 2008 at 9:39 AM
I read some more and found out that someone already noticed the same thing. Here is his solution (until the next release, when it will probably be integrated already).

http://www.codeplex.com/AvalonDock/WorkItem/View.aspx?WorkItemId=5763
Oct 6, 2008 at 9:15 PM
Hello,

I'm trying to do something very similar regarding toggling visibility....However, I'm having problems toggling it back to DockableContentState.Docked.  It does not dock back into the pane. 

I am able to set DockableContentState.AutoHide.

Any ideas?

Works
DockableContent dc = (DockableContent)Controller.Presenter.View.LeftRegion.Items[0];
Controller.Presenter.View.DockingManager.Show( dc, AvalonDock.DockableContentState.AutoHide );

Does not work
DockableContent dc = (DockableContent)Controller.Presenter.View.LeftRegion.Items[0];
Controller.Presenter.View.DockingManager.Show( dc, AvalonDock.DockableContentState.Docked);

Thanks!
Oct 6, 2008 at 9:40 PM
I'm not sure if this helps, but I found that adding the third parameter (anchor) helped position the dockable content on the desirable side of the window. If there was no dockable content that remained in the original position, then it just added it on the right (of the central document pane).

Anyway, make always sure you're using the latest version, a lot of stuff gets fixed between versions.

I'm sorry for not being more helpful.
Oct 6, 2008 at 9:45 PM
Edited Oct 6, 2008 at 10:41 PM
It works now....

In build 1692, the DockingManager has a Toogle method.

Thanks again.
Jun 4, 2009 at 9:19 PM

Quick question, when I try to (re) show hidden DockableContent I have to resize the Panel, it's there, but I need to move the splitter bar to actually see the content.

Any way to restore to a particular size?

Thanks!