NDockingPanle close and display


https://www.nevron.com/Forum/Topic7374.aspx
Print Topic | Close Window

By Andrew Ad - 11 Years Ago
Hello. I need to display and hide NDockingPanel. I`m using Display() and Close() methods.
When I call Close() or click cross on panel - panel is closed. But when I call Display() in order to restore panel on the same position I`m gettin NullReferenceException.

Panel creation code:
panel2 = new NDockingPanel { Text = "two", Key = Guid.NewGuid().ToString("N"), ID = Guid.NewGuid() };
panel2.PerformDock(manager.RootContainer.RootZone, DockStyle.Right);

Close and Display invocation:
private void hideshowToolStripMenuItem_Click(object sender, EventArgs e)
{
if (panel2.Visible)
panel2.Close();
else
panel2.Display();
}

Stack Trace:
at Nevron.UI.WinForm.Docking.NDockZoneBase.ContainsReferencedChild()
at Nevron.UI.WinForm.Docking.NDockZoneBase.CanDispose()
at Nevron.UI.WinForm.Docking.NControlHost.Update()
at Nevron.UI.WinForm.Docking.NDockZoneBase.set_Referenced(Boolean value)
at Nevron.UI.WinForm.Docking.NDockingPanelState.Reset()
at Nevron.UI.WinForm.Docking.NDockingPanel.ResetState(DockState state)
at Nevron.UI.WinForm.Docking.NDockingPanel.ResumeAfterDock(INDockZone target)
at Nevron.UI.WinForm.Docking.NDockingPanelBase.PerformDock(INDockZone zone, DockStyle style, Int32 index)
at Nevron.UI.WinForm.Docking.NDockingPanelState.Restore()
at Nevron.UI.WinForm.Docking.NDockingPanelBase.OnDisplayed(EventArgs e)
at Nevron.UI.WinForm.Docking.NDockingPanel.OnDisplayed(EventArgs e)
at Nevron.UI.WinForm.Docking.NCaptionPanel.Display()
at WindowsFormsApplication7.Form1.hideshowToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Users\andry_ad\documents\visual studio 2010\Projects\WindowsFormsApplication7\WindowsFormsApplication7\Form1.cs:line

Thanks
By Nevron Support - 11 Years Ago
Hello Andrew,

Could you check whether NDockManager.DisposePanelsOnClose is set to true. If yes, you should set it to false.
If you do not have such property I guess the version of the assemblies that you use is old.
By Andrew Ad - 11 Years Ago
Thanks, it helped