In this topic
- Integrating ArcGIS Engine controls in the WPF environment
- Binding to a specific product and initializing a license
Integrating ArcGIS Engine controls in the WPF environment
The following options are available to integrate ArcGIS Engine controls in the Windows Presentation Foundation (WPF) environment:
- Add a Windows Form containing ArcGIS Engine controls to a WPF application
- Host ArcGIS Engine controls in a WPF window
The first option is similar to what you do in a Windows Forms project; you can either use ArcGIS Engine LicenseControl or call the AoInitialize object to programmatically initialize the ArcGIS Engine license. For the second option, you must call the AoInitialize object to programmatically initialize the ArcGIS Engine license.
For more information, see Using ArcGIS Engine Controls in WPF.
Binding to a specific product and initializing a license
Starting from ArcGIS 10, you must programmatically bind to a specific ArcGIS product before accessing any ArcGIS code. Binding should be performed prior to the logic of ArcGIS Engine license initialization. Initializing an ArcGIS Engine license programmatically should be done when the application is first started.
The following code demonstrates how to bind to ArcGIS Engine 10.x and initialize an ArcGIS Engine license in the OnStartup method in the App.xaml.cs file for C# or the Application.xmal.vb file for VB .NET:
[C#] public partial class App: Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine);
InitializeEngineLicense();
}
private void InitializeEngineLicense()
{
AoInitialize aoi=new AoInitializeClass();
//Additional license choices can be included here.
esriLicenseProductCode productCode =
esriLicenseProductCode.esriLicenseProductCodeEngine;
if (aoi.IsProductCodeAvailable(productCode) ==
esriLicenseStatus.esriLicenseAvailable)
{
aoi.Initialize(productCode);
}
}
}
[VB.NET] Class Application
Protected Overrides Sub OnStartup(ByVal e As System.Windows.StartupEventArgs)
MyBase.OnStartup(e)
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine)
InitializeEngineLicense()
End Sub
Private Sub InitializeEngineLicense()
Dim aoi As AoInitialize=New AoInitializeClass()
'Additional license choices can be included here.
Dim productCode As esriLicenseProductCode=esriLicenseProductCode.esriLicenseProductCodeEngine
If aoi.IsProductCodeAvailable(productCode)=esriLicenseStatus.esriLicenseAvailable Then
aoi.Initialize(productCode)
End If
End Sub
End Class
See Also:
Using ArcGIS Engine Controls in WPFHow to host an ArcGIS Engine MapControl in a WPF application
How to add a Windows Form containing a MapControl to a WPF application
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Advanced | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Basic |