I am pretty familiar with Windows Forms in ArcGIS but WPF, which I'm just starting to tinker with, seems to be a different animal. I've created an ArcMap add-in with a button that displays a Window with some controls on it and would like to display it as a modal dialog and have it behave like other dialogs in ArcMap. That is, it should:

  1. Initially display centered in the middle of the ArcMap window
  2. Block the ArcMap main thread from continuing until the window is closed
  3. Not allow the ArcMap application's window to take the focus
  4. Not have its own task bar button or show up in the alt-tab list
  5. Always draw on top of the ArcMap window

I've gotten 1 and 2 taken care of, but the rest I haven't figured out yet.

Anyone already tackled this?

Related: How stable is WPF in Arcmap?

1 Answer 1


The key to proper parenting of WPF windows within a non-WPF application is to use the WindowInteropHelper class.

Suppose you have a WpfWindow class which is a WPF window (derives from Window):

    private void ShowWpfWindowModal()
        var parentHandle = new IntPtr(_app.hWnd); // the ArcMap window handle

        var wpfWindow = new WpfWindow(); // the WPF window instance
        var helper = new WindowInteropHelper(wpfWindow);
        helper.Owner = parentHandle;

        wpfWindow.ShowInTaskbar = false; // hide from taskbar and alt-tab list


The code snippet above also shows how to hide the window from taskbar, which is a straightforward property of the Window class.

It also has the WindowStartupLocation emum property, but its CenterOwner option does not work when the owner is not a WPF window. You need to center the window manually instead. I will not reiterate here and rather refer you to this article which gives a detailed description: Centering WPF Windows with WPF and Non-WPF Owner Windows.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.