Re-Order NUIDocuments within NDocumentManager programmatically


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

By Oliver Münchow - 12 Years Ago
Within a NDocumentManager it is quite easy to add a new document by simply calling NDocumentManager.AddDocument(). And the user is able to re-order the items by simply drag & drop them in the desired order.

But how can this be achieved programmatically? The NUIDocument doesn't have any index property and the NDocumentManager returns only a fresh array containing all available documents.
By Nevron Support - 12 Years Ago
Hi Oliver,
You need first to remove the NUIDocument from DocumentManager.Documents using RemoveDocument and then add it in the desired position:

m_Manager.DocumentManager.RemoveDocument(doc1);
NDocumentHost host = m_Manager.DocumentManager.ActiveGroup;
m_Manager.DocumentManager.AddDocument(doc1, host, desiredIndex);

Of course, it applies when document view is MdiTabbed.