Dragging Document Exception when binding to ObservableCollection

Aug 15, 2008 at 6:21 PM
Hi adospace,
I was able to bind the DocumentPane.ItemsSource to an ObservableCollection and it works nicely so far. However, each time I drag a Document on the tab, I receive an Exception.
I could guess the reason is when we bind the ItemsSource, a direct manipulation (remove, add) on the Items is not allowed anymore.

 public virtual ManagedContent RemoveContent(int index)
            ManagedContent contentToRemove = Items[index] as ManagedContent;

            Items.RemoveAt(index); // HERE COMES THE EXCEPTION

            return contentToRemove;

Do you have any idea how to solve the problem.
Aug 26, 2008 at 4:26 PM
Sorry for late in response, have you found a solution? which kind of exception is thrown?
Aug 29, 2008 at 2:27 PM
Hi adospace,
Thanks for your reply. I think it is not a good idea to bind the DocumentPane.ItemsSource to our own (observable) collection as the AvalonDock manipulates the Items directly at many places and the use of ItemsSource Data Binding and Items are exclusive (either or but not both).

Due to the  lack of time, I temporarily commented out all codes that lead to a direct manipulation of Items and it works for my purpose. Certainly, it is not a nice solution though.