关于在WPF应用程序中使用ArcGIS Engine控件的局限性

 ArcGIS Engine controls are Windows Forms controls. Before developing a Windows Presentation Foundation (WPF) application using ArcGIS Engine controls, consider the following limitations:

  1、 The ArcGIS License Control cannot be used when hosted in a WPF window. You must initialize the ArcGIS Engine license programmatically. For more information, see here:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using ESRI.ArcGIS.esriSystem;


namespace WpfApplication1
{
     /// <summary>
     /// App.xaml 的交互逻辑
     /// </summary>
     public partial  class App : Application
    {
         protected  override  void OnStartup(StartupEventArgs e)
        {
             base.OnStartup(e);
           
          
            InitializeEngineLicense();
        }

         private  void InitializeEngineLicense()
        {
            //注意下边这一句最后必须是EngineOrDesketop而不是Engine
            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
            //By default, the form uses the old-fashioned (pre-Windows XP) styles for common controls in a WPF application. To enable the newer styles
            System.Windows.Forms.Application.EnableVisualStyles();

            AoInitialize aoi =  new AoInitialize();

             //More license choices can be included here.
            esriLicenseProductCode productCode =
                esriLicenseProductCode.esriLicenseProductCodeEngine;
             if (aoi.IsProductCodeAvailable(productCode) ==
                esriLicenseStatus.esriLicenseAvailable)
            {
                aoi.Initialize(productCode);
            }
        }
    }

}

  2、The properties and events of ArcGIS Engine controls are not accessible through Extensible Application Markup Language (XAML). You must programmatically access them in the code behind file.

  3、ArcGIS Engine controls do not have dependency properties, and only one-way data binding is supported. ArcGIS Engine control properties can only be bound to a WPF element, and the opposite binding is not supported.

  4、ArcGIS Engine controls are rendered separately from WPF elements. As a result, all display related properties of a WPF host container, such as Transform, Clip, and Opacity, have no effect on the control.

  5、Windows Forms controls draw outside of the WPF drawing framework and are assigned the highest rendering order. Therefore, you should avoid the following:

  Overlapping WPF elements on top of the ArcGIS Engine controls

  Overlapping ArcGIS Engine controls on WPF elements

  These limitations apply to all Windows Forms controls that are hosted by a WPF application.

你可能感兴趣的:(WPF)