C# WPF的ArcGIS运行时-缺少程序集引用?
我已经为.NET安装了ArcGIS运行时SDK(100.1.0) 我从ArcGIS模板创建了一个WPF应用程序(应该附带所有必要的程序集引用…) 我有一个“地图视图”(我的XAML文件),其中包含一个我只想添加一个图层的地图。我用过。我的XAML如下所示:C# WPF的ArcGIS运行时-缺少程序集引用?,c#,wpf,arcgis-runtime,arcgis-runtime-net,C#,Wpf,Arcgis Runtime,Arcgis Runtime Net,我已经为.NET安装了ArcGIS运行时SDK(100.1.0) 我从ArcGIS模板创建了一个WPF应用程序(应该附带所有必要的程序集引用…) 我有一个“地图视图”(我的XAML文件),其中包含一个我只想添加一个图层的地图。我用过。我的XAML如下所示: <Page x:Class="WpfApplication1.Views.MapView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xm
<Page x:Class="WpfApplication1.Views.MapView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApplication1.Views"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="MapView">
<Grid>
<Grid.Resources>
<esri:SimpleLineSymbol x:Key="SLS" Color="Transparent" Width="1"/>
<esri:SimpleLineSymbol x:Key="BlackSLS" Color="Black" Width="1"/>
</Grid.Resources>
<Grid>
<esri:MapView x:Name="MyMapView" />
</Grid>
</Grid>
</Page>
此时,Visual Studio警告我“地图不包含图层[…]的定义。是否缺少using指令或程序集引用?”
如果我决定直接从XAML添加图层,而不编写任何代码:
<Page x:Class="WpfApplication1.Views.MapView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApplication1.Views"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="MapView">
<Grid>
<Grid.Resources>
<esri:SimpleLineSymbol x:Key="SLS" Color="Transparent" Width="1"/>
<esri:SimpleLineSymbol x:Key="BlackSLS" Color="Black" Width="1"/>
</Grid.Resources>
<Grid>
<esri:MapView x:Name="MyMapView">`enter code here`
<esri:Map>
<esri:ArcGISDynamicMapServiceLayer Url=... />
</esri:Map>
</esri:MapView>
</Grid>
</Grid>
</Page>
`在这里输入代码`
设计器现在警告“名称空间中不存在名称ArcGISDynamicMapServiceLayer”
我做错了什么?看起来我没有加载API的所有适当组件,即使我正在使用SDK的WPF模板。。。我很困惑
我正在MS Windows Server 2012上运行Visual Studio 2015 Update 2(如果相关的话!)您使用的代码用于10.2版本的ArcGIS Runtime for.NET。您可以在100.1版本中看到如何使用本地服务器。错误是正确的。该类在v100.1中不存在。您可能正在寻找这个类:“Esri.ArcGISRuntime.Mapping.ArcGISTiledLayer”实际上,我尝试使用的东西只在v10.2.7(及更早版本)中可用。我卸载了SDK的v100.1.0.0,改为安装了v10.2.7。为什么以前的版本中有这么多功能现在缺失了?例如,您现在如何以编程方式将图层添加到地图?@dotMorten我在项目中引用了ArcGIS运行时v100.1.0.0,但无法访问您在v100系列中指定的名称空间。我们将本地服务器功能与基本安装分离,以使其更加模块化。尽管如此,您仍然拥有相同的功能。由于v100系列是该产品的新主要版本,API与前几代(即10.2系列)不同。您可以使用
ArcGISMapImageLayer localServiceLayer=new ArcGISMapImageLayer(mapServiceUrl)轻松地将图层添加到地图中;MyMapView.Map.OperationalLayers.Add(localServiceLayer)代码>
<Page x:Class="WpfApplication1.Views.MapView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApplication1.Views"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="MapView">
<Grid>
<Grid.Resources>
<esri:SimpleLineSymbol x:Key="SLS" Color="Transparent" Width="1"/>
<esri:SimpleLineSymbol x:Key="BlackSLS" Color="Black" Width="1"/>
</Grid.Resources>
<Grid>
<esri:MapView x:Name="MyMapView">`enter code here`
<esri:Map>
<esri:ArcGISDynamicMapServiceLayer Url=... />
</esri:Map>
</esri:MapView>
</Grid>
</Grid>
</Page>