This project is read-only.

DocumentPane and ResizePanel

Feb 26, 2009 at 8:58 AM

I'm trying to set a ResizingPanel.ResizeWidth to a DocumentPane and it doesn't work. I saw in the demo that the ResizePanel properties works only with DockablePane but haven't any effects on a DocumentPane.

For example :

<ad:DocumentPane x:Name="_documentsHost" ad:ResizingPanel.ResizeWidth="200">--> The size will not be 200...
<ad:DockablePane x:Name="_dockableHost" ad:ResizingPanel.ResizeWidth="200">--> The size will be 200...

Is anybody knows why? Or there is another solution to set (progammaticly) the prefered size of a DocumentContent or a DocumentPane.

Thank you!!!
Feb 26, 2009 at 4:02 PM
DocumentPanes always accopies all the available space, at least using the default template.
Why you should set to a preferred size for it?
Feb 27, 2009 at 9:47 AM
Edited Feb 27, 2009 at 9:50 AM
In fact I have a DockingManager which might contain lot of DocumentPane.
I would offer a button to the user to redraw the DockingManager. In redraw, I mean take all DocumentPane and place them all in a square of equal distributed size.

For example :

Before redraw :  

DocPane 1
DocPane 2
DocPane 3
DocPane 6
DocPane 4
DocPane 5

After redraw (progammaticly) :

DocPane 1
DocPane 2
DocPane 3
DocPane 4
DocPane 5
DocPane 6

So, that's why I prefer to set a prefered size ;)

Thank you!
Feb 27, 2009 at 11:17 AM
Ok, try to use code like this:

<ad:DocumentPaneResizingPanel Orientation="Vertical">
<ad:DocumentContent x:Name="doc1" Title="Doc1" />
<ad:DocumentContent x:Name="doc2" Title="Doc2" />
<ad:DocumentPaneResizingPanel ad:ResizingPanel.ResizeHeight="200">
<ad:DocumentContent x:Name="doc3" Title="Doc3" />
<ad:DocumentPane >
<ad:DocumentContent x:Name="doc4" Title="Doc4" />

DocumentPaneResizingPanel class is the key, it's the preferred container for
document panes.

Feb 27, 2009 at 1:01 PM
It looks good but I missed to precise that I need to do this progammaticly because I don't know the number of DocumentPane present in the DockingManager...
I have to create the structure you wrote programmaticly...

Something like that :

DocumentPaneResizingPanel.SetResizeWidth(myDockManager, 200); //For orientation???

foreach (DocumentPane document in myDockManager.Documents) {
    DocumentPaneResizingPanel.SetResizeWidth(document , 200);
    myDockManager.Anchor(document , documentRelative, AnchorStyle.Bottom OR Right); //I have a specific code to get the relative Pane and the AnchorStyle which run correctly...

but it doesn't work...

Feb 27, 2009 at 2:38 PM
Programmatically at runtime is more complicated because you need to
completely discard the current layout and recreate a new one from scratch.
This is a way to achive that, of course is not much tested:

DocumentPaneResizingPanel panelContainer =
_dockingManager.MainDocumentPane.Parent as DocumentPaneResizingPanel;
DocumentContent[] docs = _dockingManager.Documents;
//if panelContainer == null it means that we have a only docuument pane with
all contents in it
if (panelContainer == null)
ResizingPanel originalParentContainer =
int indexOfMainDocumentPane =
panelContainer = new DocumentPaneResizingPanel();
if (originalParentContainer.Orientation == Orientation.Horizontal)
panelContainer.Orientation = Orientation.Horizontal;
bool mainDocumentPaneIsSet = false;
foreach (DocumentContent doc in docs)
DocumentPane oldContainerPane = doc.Parent as DocumentPane;
DocumentPane docPane = null;
if (mainDocumentPaneIsSet)
docPane = new DocumentPane();
docPane = _dockingManager.MainDocumentPane;
mainDocumentPaneIsSet = true;
ResizingPanel.SetResizeWidth(docPane, 200);

Mar 8, 2009 at 1:29 PM
Hi ado!

Sorry to answer you only now but my planning is very busy..
I used your code with some improvements and the result is absolutly perfect!

FYI I'm working on a project in Switzerland (Fribourg). Your DockingManager is used to show many video streams.
I want to say you a big THANK YOU!!!

If you want to know more about my project, tell me.

See you!