以下代码给我一个空引用。
foreach (DockPanel dockPanel in dockManager1.Panels){
dockPanel.MakeFloat();
tabbedView1.Controller.CreateNewDocumentGroup(tabbedView1.Controller.RegisterDockPanel(dockPanel.FloatForm) as Document);
}
dockPanel.FloatForm特别在调试器中显示为NULL,即使MakeFloat();应该设置它http://documentation.devexpress.com/#WindowsForms/DevExpressXtraBarsDockingDockPanel_MakeFloattopic379
答案 0 :(得分:0)
没有理由使用DockPanel.MakeFloat方法将停靠面板停靠为选项卡式文档。您应该使用DockPanel.DockAsMdiDocument方法。 因此,正确的代码应如下所示:
foreach(DockPanel dockPanel in dockManager1.Panels) {
if(dockPanel.DockAsMdiDocument()) {
var document = tabbedView1.Manager.GetDocument(dockPanel) as Document;
tabbedView1.Controller.CreateNewDocumentGroup(document);
}
}