Using ArcGIS Engine Controls in WPF


In this topic


Integration of Windows forms and WPF content

The Windows Presentation Foundation (WPF) is an entirely new graphical display system for Windows. WPF is designed for .NET and is built on DirectX, which provides hardware acceleration and enables modern user interface (UI) features such as, transparency, gradients, and transforms.
The following are the different strategies to integrate Windows Forms and WPF content:
  • Place each platform in a separate window.
  • Mix content from both platforms in a single window.
To integrate ArcGIS Engine controls—which are Windows Forms controls—in a WPF environment, there are the following options:
  • Using the controls as a part of a Windows Form separate from WPF windows; or
  • Hosting the controls in a WPF window.

Adding Windows Forms to a WPF application

In Visual Studio, add a Windows Forms template in a WPF project, then add ArcGIS Engine controls on the form the same way as you do in a Windows Forms project, as shown in the following screen shots. This window-by-window separation is the easiest approach as each window just deals with a single technology. The interoperability is to create and show your forms.
  
There are additional considerations when showing these forms at runtime. For more information, see How to add a Windows Form containing a MapControl to a WPF application.

Hosting ArcGIS Engine controls in a WPF window

The WindowsFormsHost control provides a container where a single Windows Forms control can be hosted on a WPF window or page, as shown in the following screen shot. As a result, you can mix ArcGIS Engine controls with WPF elements in the same window so that they can interact directly with each other. For more information, see How to host an ArcGIS Engine MapControl in a WPF application.
Since both platforms have a separate window handle (hwnd), follow the "Airspace" rule when creating a window with mix content. For example, you cannot overlap WPF elements with ArcGIS Engine controls in the same window. In this case, ArcGIS Engine controls are always drawn on top of WPF content. Similarly, you cannot overlap a partially transparent map over a WPF region to blend them together, and so on. Also, remember that with the WindowsFormsHost, potential issues of interoperability might be raised between Windows Forms and WPF platforms. For more information, see Limitations on using ArcGIS Engine controls in WPF.
In summary, underlying features in WPF is a powerful new drawing pipeline based on DirectX. Unlike Windows Forms, it is possible to create rich UIs and visual effects without incurring the performance overhead.


See Also:

WPF and Win32 Interoperation Overview
WPF Interoperation: "Airspace" and Window Regions Overview
How to add a Windows Form containing a MapControl to a WPF application
How to host an ArcGIS Engine MapControl in a WPF application




Development licensing Deployment licensing
Engine Developer Kit ArcView
ArcEditor
ArcInfo
Engine Runtime