This project is read-only.

DocumentsSource & Order

Jun 13, 2012 at 3:16 PM



I'm suprised to face a simple issue : DockingManager.DocumentsSource is binded to an ObservableCollection. I've tried to insert an element in the collection, at the begining ... but the new tab for document appear at the end.

Order isn't used after initialisation ... maybe you can take in count NewStartingIndex property of NotifyCollectionChangedEventArgs ?



Jun 13, 2012 at 4:39 PM

Hum, I think it's not so simple because when a document is inserted in the list, AvalonDock must decide where to put it. In complex layout it's possible that more than one LayoutDocumentPane is present. By default it use the LastFocusedDocument container if it exists or the first one it can find. Inside the LayoutDocumentPane, document list is usually reordered by the user and it doesn't match to the source DocumentSource list. Using the source list index doesn't garentee that you place a document before or after another document.


Jun 15, 2012 at 9:58 AM

I wondered why you put the DocumentsSource property on the DockingManager... wouldn't be easyier to have a ItemsSource property on the LayoutDocumentPane ?

Jun 15, 2012 at 10:32 AM

the problem was that LayoutDocumentPanes are created and disposed at runtime as the user arrange the layout, also can happen that there will be more than one LayoutDocumentPane. For example if you drop a LayoutDocument beside another LayoutDocument, AD creates a LayoutDocumentPaneGroup with two LayoutDocumentPane inside.

Jul 10, 2012 at 8:43 AM

Hi again


I just noticed that DocumentsSource is not updated on document closing. My document are still in the source collection after click on close cross, and not displayed on the screen ... normal? :|

Jul 10, 2012 at 11:17 AM

DocumentsSource is not updated by the manager, you should handle the Close command and remove the document by your self, Ado