Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using ArcObjects 9.3 .NET. In my ArcMap dockable window, I have a single element host hosting a WPF user control (That's the only means of using WPF for ArcMap extensions as far as I know).

While most things work fine, I am experiencing a known issue with WPF/Winforms interoperability that I can't quite solve. In particular, when I have focus on my dockable window (a textbox in my WPF control in the element host to be exact) and then alt-tab from ArcMap and go back into ArcMap again, the cursor continues to blink in the textbox within my dockable window, but no text appears when I type. In fact, the focus seemed as if it went to the main ArcMap window, and anything that I type appears to trigger the ArcMap menu shortcuts (F -> File, E-> Edit) etc.

Further research led me to this thread, with a similar problem: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1b50fec6-6596-4c0a-9191-32cd059f18f7/

The workaround proposed was to listen to the Activated Event of the parent form. Upon the Activated event, do a .Focus() on the WPF user control.

However as the parent form in this case is probably the ArcMap window itself, I am having trouble accessing it from the DockableWindow. I can get the dockable window's parent control via .Parent or .ContainerControl, but these controls don't expose the .Activated event as they are technically not Form objects.

Any ideas how I can listen to the activated event (aka when ArcMap gets refocused from an alt-tab event)?

Thanks in advance!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.