我是Silverlight应用程序的新手,最近需要开发一个ArcGIS系统 通过 Visual Studio Community 2022 用 C# 编写。 我遇到的主要问题是 .xaml 文件中使用的 ArcGIS 标签。由于微软不再维护Silverlight,系统开发中的dll问题变得难以掩盖。 我使用的代码片段如下:
<UserControl x:Class="SilverlightApplication20230823.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
xmlns:Anno="http://schemas.microsoft.com/expression/blend/extensions/annotations/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<TextBlock Text="Waiting"></TextBlock>
<esri:SimpleFillSymbol x:Key="DarkRedFillSymbol" Fill="#CC781F1D" BorderBrush="#FF7E1A17" BorderThickness="1" />
</Grid>
</UserControl>
dll及其版本如下:
ESRI.ArcGIS.Client 10.2.5.825
ESRI.ArcGIS.Client.Behaviors 10.2.5.825
ESRI.ArcGIS.Client.Toolkit 10.2.5.823
ESRI.ArcGIS.Client.Toolkit.DataSources 10.2.1.431
背后的代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xaml;
using System.Runtime.Serialization;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Geometry;
using ESRI.ArcGIS.Client.Symbols;
using ESRI.ArcGIS.Client.Tasks;
namespace SilverlightApplication20230823
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}
浏览器中的错误消息显示如下: “Silverlight 应用程序中出现未处理的错误,无法 将“ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol”实例转换为“System.Windows.Controls.UIElementCollection”。 有没有办法解决这个问题,非常感谢。
您不能在网格中放置填充符号。它不是 UI 元素,而是如何在地图上渲染符号的定义。你可以把它放在 Grid.Resources 中。
顺便说一句,我很惊讶您是 Silverlight 新手。 Silverlight 不再受到任何地方的支持,Esri SDK 也已经失去支持很多年了。