To reproduce: - Add a document window uppopn a button click. Put the button inside a tool window. Workaround: Use ActiveWindowChanged event.