Hi,
I have been looking at your KB09844 article and accompanied source code for the past few days now trying to make sense of it all. All I want to do is, at runtime open a user control in the main form if it was opened when the application was last closed, using the loadFromXml method. Thats it. Is there not an easier way of doing this than having to implement the ControlledWorkItem, WorkItemController, Module, ModuleController, RootViewPresenter etc. classes??? I know that previously we were using DevExpress and it was as simple as saving the layout when exiting and all forms that were opened would be saved. Any help or examples would be appreciated.
Thanks.
When loading a layout, the UltraDockManager requires that the controls that were docked when saving the layout are somewhere on the control the dock manager is hosted in. If any controls are not present, they will not be loaded. There is a good chance the docked controls will have state information, and the dock manager cannot store that info when saving the layout, so it cannot recreate these controls with their correct state automatically. You can also submit a feature request for an event that gets fired when loading a layout and a control to create a loaded pane cannot be found: http://devcenter.infragistics.com/Protected/RequestFeature.aspx. This will prevent the need from having the control on the form when the dock manager is loaded.
Thanks for the quick reply, but that didn't really solve my problem. Here is a very basic example of what I am trying to do.
public partial class Form1 : Form { private DockAreaPane m_dockAreaLeft = null; public Form1() { InitializeComponent(); if( !File.Exists( "C:\\Documents and Settings\\orrie.shannon\\Desktop\\settings.txt" ) )
{ m_dockAreaLeft = new DockAreaPane( DockedLocation.DockedLeft ); m_dockAreaLeft.ChildPaneStyle = ChildPaneStyle.HorizontalSplit; DockWorkspace.DockAreas.Add( m_dockAreaLeft ); DockableControlPane testPane = new DockableControlPane(); testPane.Text = "test"; testPane.Control = new TestUserControl(); //where TestUserControl is a very basic UserControl with no functionality m_dockAreaLeft.Panes.Add( testPane ); } else { DockWorkspace.LoadFromXML( "C:\\Documents and Settings\\orrie.shannon\\Desktop\\settings.txt" ); } } private void Form1_FormClosed( object sender, FormClosedEventArgs e ) { this.DockWorkspace.SaveAsXML( "C:\\Documents and Settings\\orrie.shannon\\Desktop\\settings.txt" ); } }
The first time this is run the testPane appears docked on the left hand side as it should, and it seems as though the it is being saved in the xml file ( from the line "<Text id="ref-18">test</Text>" ). But, when DockWorkspace.LoadFromXML() is called this pane does not re-appear. What am I doing wrong?