DocumentPane Background colour does not persist during SaveLayout, RestoreLayout

Jul 22, 2010 at 12:19 PM

Dear all,

I have a DockingManager which contains a ResizingPanel which contains a DocumentPane which contains several DocumentContent objects. If I save the layout and restore the layout of the docking manager using SaveLayout and RestoreLayout respectively, the background colour of the document pane is nullified (shown grey). Also, if I try to set the background colour of the document pane in code behind after calling RestoreLayout, it has no effect. However if I don't call RestoreLayout the background colour is set ok. Not sure if this problem also exists for DockablePane.

Can anyone possibly help with this,

Best wishes,





Jul 22, 2010 at 2:21 PM

Yeah, fun times...


I just solve this problem a few weeks ago. My solution to this was to create a property that passed back either the document pane, the dockManager.MainDocumentPane, or the pane i saved once I finished restoring the layout like so:



private void RestoreDockingkLayout()
         SubjectMatterTabControl.SelectionChanged -= SubjectMatterTabControlContent_SelectionChanged;
         MainTabControl.SelectionChanged -= MainTabControlContent_SelectionChanged;
          // attach events to new content panes
          if (SubjectMatterTabControl != null)
                SubjectMatterTabControl.SelectionChanged += SubjectMatterTabControlContent_SelectionChanged;
          MainTabControl.SelectionChanged += MainTabControlContent_SelectionChanged;
          subjectMatterPane = SubjectMatterTabControl;
          DockableContent tab = MainTabControl.SelectedItem as DockableContent;




		public DocumentPane SubjectMatterTabControl
				DocumentPane pane;
				if (SubjectMatterTabControlContent != null && SubjectMatterTabControlContent.Items.Count > 0)
					pane = SubjectMatterTabControlContent;
				else if(dockManager.MainDocumentPane != null && dockManager.MainDocumentPane.Items.Count > 0)
					pane = dockManager.MainDocumentPane;
                else {
                    pane = subjectMatterPane;
                return pane;

The problem is that once content is restored, it is placed in new DocumentPanes and DockablePanes. So you were setting the backgrounds of the wrong panes.

I hope this helps :)



Aug 10, 2010 at 9:15 AM

Dear Woshiernog,

Thanks for that. I have'nt yet implemented your solution in full, but I have tried changing the background colour  of the object pointed to by DockingManager.MainDocumentPane and all seems to work well. It looks, as you say that a pointer is lost when calling RestoreLayout. Can you chaps at Adospace take a look when you get the chance, ta.

Thanks Wosheirnog,