I am in the process of moving our application to the new docking interface, and need a little assistance related to floating window focus.
Our application has many menu commands that operate on the document window specified in the DockSite.PrimaryDocument property. Let's say I have two document window tabs in the main window, and I float one of them to create a new window with a new tab group. I then select the document in the new floating window in order to run a menu command against it (Copy/Paste, for example). The PrimaryDocument property changes to the document in the floating window. When I go to the menu to select a command, the document in the main window regains focus and the PrimaryDocument property changes back to that window. So when I execute the command, it gets executed against the wrong document.
Visual Studio's behavior for document tabs in floating windows seems to be a little different. If I float a document to a new window, then go to the menu or toolbars to select a command, the document in the floating window remains focused so that the command executes against that document. This is how I would expect our floating windows to work as well.
I tried various methods to intercept different focus events and handle them, but the PrimaryDocument property changes before the focus events even fire.
Do you have any suggestions for how I would be able to get the desired focus behavior?