bug in DockingManager.Show(DocumentContent document)

Sep 30, 2009 at 3:07 AM

I've downloaded the demo, and run it.

While I put DocumentContent as a floating window, and click "Server Explorer"'s "Click Me" button, application throws a "InvalidOperationException" tells me:

"Element already has a logical parent. It must be detached from the old parent before it is attached to a new one."

After examining the "Show(DocumentContent document)" Function, it appears to forget to deal with the situation while "document" is a floating window, so with a bit fix, program runs again.

code blow:

        public void Show(DocumentContent document)
        {
            if (document.Parent is FloatingDockablePane) {
                document.SetAsActive();
                return;
            }

            bool found = false;
           // ...

         }

Anyway, it's a great work for both studying WPF and Hacking Docking internals. Thanks very much!