Restoring closed panes

May 24, 2009 at 3:31 PM

I want to create an environment similar to visual studio.

The environment should allow closing all the window and bringing them back to view via main menu. I was not able to achieve this - when I close a dockable content that shares a pane with another dockable content, everything is fine and the content reappears in the pane. However, when the closed content was the last content in the pane, the pane disappears and when the content is shown again, it is shown docked to right and with zero width. Is there some easy way for the window to reappear in the position it was before closing? Playing with it I was able to make it appear docked to left, but even with following code, the width is still zero and the pane must be resized by mouse to appear.

DockableContent Navigator;

...

dockingManager.Show(Navigator, DockableContentState.Docked, Navigator.SavedStateAndPosition.DockTo);
ResizingPanel.SetResizeWidth(Navigator, new GridLength(Navigator.SavedStateAndPosition.Width));
Navigator.Width = Navigator.SavedStateAndPosition.Width;

Any suggestions?

 

 

May 25, 2009 at 8:28 AM

I've got the same problem.. I need to be able to do:

 

dockingManager.Hide( dockableContent );

...

dockingManager.Show( dockableContent );

 

and have it restored at the same position as before, even if it is the only content in a DockablePane. I tried to resolve the issue myself in the source but did not succeed until now..

May 25, 2009 at 8:49 AM

I resolved the issue..

 

@trupik: Message me to get the code update..

 

@The AvalonDock builder: How can i submit any code changes for your review?

 

Greets,

Ben

May 27, 2009 at 9:07 AM

Please send me the code update

jakub.maly@atlas.cz

Jun 1, 2009 at 10:47 AM

I have the same problem.

Can I see your proposed solution?

Jun 5, 2009 at 8:47 PM

Can someone post a solution please!  Thanks!!

Jun 6, 2009 at 8:32 PM

I figured out how to get this to work.  Open DockingManager.cs, and at around Line 1697 you will see two lines commented out:

//ResizingPanel.SetResizeHeight(newHostpane, w);

and a little further down:

//ResizingPanel.SetResizeHeight(newHostpane, h);

Replace these commented out lines with:

ResizingPanel.SetEffectiveSize(newHostpane, new Size(w, 0.0));

and

ResizingPanel.SetEffectiveSize(newHostpane, new Size(0.0, h));

respectively.

Jun 9, 2009 at 12:47 PM

I have also the problem with the wrong position of the content when it was hidden. It appears always on the right border. I have no problem with the size of the pane. I use the version 1.1.1714.0. I saw that there is a newer version, but it isn't released yet.

Do you know whether the behaviour changed in the new version and do you know when this version will be released?

Jun 9, 2009 at 5:41 PM

Yeah, I had the same problem.  I poked around in the code a bit and it looks like the panes don't maintain knowledge of what Anchor they are currently docked to so they don't save this knowledge when you hide them.  So when you use the DockManager.Show() method to show a hidden pane the code defaults to docking them to the right.  Unfortunately the only way I can see currently to dock them in another location on Show() is to explicity set the Anchor on one of the Show() override.  You can't even really implement saving/restoring the anchor position right now because the Panes themselves don't provide a property that contains the correct Anchor (the Anchor property on panes never seems to be set correctly).

Jun 9, 2009 at 6:00 PM

Not sure this helps for docking, but i did find in the latest build it now (when opening) checks width and height <> NaN, which is false....the width and height are 0 causing the pane not to display.

I added some code to my local dll, checking for width or height = 0; if true, I set the "default" w/h size of 200

Jun 12, 2009 at 4:05 PM
Edited Jun 12, 2009 at 4:05 PM

HI all,

in latest svn source (at moment build 1.2.2252) the anchor position should be correctly saved and restored for hidden contents. Work is not yet completed, but a first step in the right direction should be visible :)

thx

Ado

 

 

Jun 29, 2009 at 4:25 PM
Edited Jun 29, 2009 at 4:27 PM

Hi,

I had the same problem and downloaded the newest version from svn. Now it works better. The hidden panes appear again. So, for this fix many thx :-)

But there is an other thing that is not completly right. As you can see in the xaml, I have a DockablePane called "DockPaneLeft" and inside 2 DockableContents. When I close these contents with DockingManager.hide(...) and later show them again with DockingManager.show(...) they appear on the right side of the window and in the right size, but not the same way stacked as they where before.
The two DockableContents are tabbed in the DockablePane and after hinding and showing them, they are not tabbed. They are in the DockablePane, but lie side by side.

Maybee you can try and see if you can reproduce this behavier with my code. If you need some more information about this, tell me, I will write you.

And thx for the realy good tool. :-)

Alex

 

<ad:DockingManager x:Name="MyDockingManager">
            <ad:ResizingPanel Orientation="Horizontal">
                <ad:DockablePane ad:ResizingPanel.ResizeWidth="250" x:Name="DockPaneLeft" >
                    <ad:DockableContent Title="Project Explorer" x:Name="ProjectExplorer" >
                        <TextBox Background="BurlyWood"/>
                    </ad:DockableContent>
                    <ad:DockableContent Title="Project Explorer 2" x:Name="ProjectExplorer2" >
                        <TextBox Background="Aqua" />
                    </ad:DockableContent>
                </ad:DockablePane>
                <ad:ResizingPanel Orientation="Vertical">
                    <ad:DocumentPane>
                        <ad:DocumentContent Title="Project Chooser">
                            <TextBox Background="Green"/>
                        </ad:DocumentContent>
                        <ad:DocumentContent Title="Editor">
                            <TextBox Background="Yellow"/>
                        </ad:DocumentContent>
                    </ad:DocumentPane>
                    <ad:DockablePane ad:ResizingPanel.ResizeHeight="100" ad:ResizingPanel.ResizeWidth="150">
                        <ad:DockableContent Title="Properties" x:Name="Properties">
                            <TextBox Background="Red" Text="Hello World" />
                        </ad:DockableContent>
                    </ad:DockablePane>
                </ad:ResizingPanel>
            </ad:ResizingPanel>
        </ad:DockingManager>