0

I am a newbie to Silverlight application, and recently need to develop a ArcGIS system written in C# via visual studio community 2022. The main problem I meet is the ArcGIS tag using in .xaml files. Since microsoft has no longer maintain Silverlight, the dll problem in system developing become hard to cover. the code snippet I use is as below:

<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>

the dlls and its version is as following:

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

the code behind is following:

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();

        }
    }
}

The error message in browser showing like this: "Unhandled Error in Silverlight Application, can not turn 'ESRI.ArcGIS.Client.Symbols.SimpleFillSymbol' instance to 'System.Windows.Controls.UIElementCollection'". Is there any solution to cover this problem , thanks a lot.

abramhum
  • 443
  • 2
  • 8
  • 20

1 Answers1

1

You can't put a fill symbol in a grid. It's not a UI element, but a definition of how to render a symbol on a map. You could put it Grid.Resources.

Btw I'm surprised you're new to Silverlight. Silverlight is no longer supported anywhere, and the Esri SDK has been out of support for many many years now.

dotMorten
  • 1,953
  • 1
  • 14
  • 10