I have been using the RadDock control to manage my MDIs for me. This has been reasonably successful until I save a layout to reload later.
I am trying to reload the content using radDock1_DockWindowAdded()
if (e.DockWindow.Name.StartsWith("input1"))
{
input1 in1 = new input1();
in1.Text = e.DockWindow.Text;
in1.MdiParent = this;
((HostWindow)e.DockWindow).LoadContent(in1);
This appears to work but I get an exception
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.WinControls.UI.Docking.RadDock.RegisterWindow(DockWindow dockWindow)
at Telerik.WinControls.UI.Docking.RadDock.EnsureRegisteredWindow(DockWindow window, RadDockTransaction transaction)
at Telerik.WinControls.UI.Docking.RadDock.EnsureTransaction(RadDockTransaction transaction)
at Telerik.WinControls.UI.Docking.RadDock.CommitTransaction(RadDockTransaction transaction)
at Telerik.WinControls.UI.Docking.RadDock.CommitTransactions()
at Telerik.WinControls.UI.Docking.RadDock.EndTransactionBlock()
at Telerik.WinControls.UI.Docking.RadDock.LoadFromNewXml(XmlReader reader)
at Telerik.WinControls.UI.Docking.RadDock.LoadFromXmlCore(XmlReader reader, Boolean oldXmlFormat)
at Telerik.WinControls.UI.Docking.RadDock.LoadFromXml(String fileName)
at TELMDI.Form1.LoadSavedLayout()
and the radDock1_LoadedFromXml never fires.
When I check my raddock1.MDIChildren they all appear to be there and they are also correctly applied on screen.
But when I then try to add new MDIs I cannot set the parent to be this; so something obviously gets corrupted.
If instead I change the order so that I LoadContent and then set MDI I get 2 new windows and the following exception
input1 in1 = new input1();
in1.Text = e.DockWindow.Text;
((HostWindow)e.DockWindow).LoadContent(in1);
in1.MdiParent = this;
'System.InvalidOperationException' occurred in Telerik.WinControls.RadDock.dll
14:26:09 DockWindowAdded input13=System.InvalidOperationException: Cannot reload content for a HostWindow, which is bound to a MDI Child.
at Telerik.WinControls.UI.Docking.HostWindow.VerifyContentChange()
at Telerik.WinControls.UI.Docking.HostWindow.LoadContent(Control content)
at TELMDI.Form1.radDock1_DockWindowAdded(Object sender, DockWindowEventArgs e) in E:\VS2008 Projects\telerik_test\TELMDI\Form1.cs:line 153
Does anyone know the correct way of reloading MDI content after loadfromxml?
Thanks in advance.
I am trying to reload the content using radDock1_DockWindowAdded()
if (e.DockWindow.Name.StartsWith("input1"))
{
input1 in1 = new input1();
in1.Text = e.DockWindow.Text;
in1.MdiParent = this;
((HostWindow)e.DockWindow).LoadContent(in1);
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.WinControls.UI.Docking.RadDock.RegisterWindow(DockWindow dockWindow)
at Telerik.WinControls.UI.Docking.RadDock.EnsureRegisteredWindow(DockWindow window, RadDockTransaction transaction)
at Telerik.WinControls.UI.Docking.RadDock.EnsureTransaction(RadDockTransaction transaction)
at Telerik.WinControls.UI.Docking.RadDock.CommitTransaction(RadDockTransaction transaction)
at Telerik.WinControls.UI.Docking.RadDock.CommitTransactions()
at Telerik.WinControls.UI.Docking.RadDock.EndTransactionBlock()
at Telerik.WinControls.UI.Docking.RadDock.LoadFromNewXml(XmlReader reader)
at Telerik.WinControls.UI.Docking.RadDock.LoadFromXmlCore(XmlReader reader, Boolean oldXmlFormat)
at Telerik.WinControls.UI.Docking.RadDock.LoadFromXml(String fileName)
at TELMDI.Form1.LoadSavedLayout()
and the radDock1_LoadedFromXml never fires.
When I check my raddock1.MDIChildren they all appear to be there and they are also correctly applied on screen.
But when I then try to add new MDIs I cannot set the parent to be this; so something obviously gets corrupted.
If instead I change the order so that I LoadContent and then set MDI I get 2 new windows and the following exception
input1 in1 = new input1();
in1.Text = e.DockWindow.Text;
((HostWindow)e.DockWindow).LoadContent(in1);
in1.MdiParent = this;
'System.InvalidOperationException' occurred in Telerik.WinControls.RadDock.dll
14:26:09 DockWindowAdded input13=System.InvalidOperationException: Cannot reload content for a HostWindow, which is bound to a MDI Child.
at Telerik.WinControls.UI.Docking.HostWindow.VerifyContentChange()
at Telerik.WinControls.UI.Docking.HostWindow.LoadContent(Control content)
at TELMDI.Form1.radDock1_DockWindowAdded(Object sender, DockWindowEventArgs e) in E:\VS2008 Projects\telerik_test\TELMDI\Form1.cs:line 153
Does anyone know the correct way of reloading MDI content after loadfromxml?
Thanks in advance.