【问题贴,尚不知如何解决】

在GraphicsLayer中添加一个点,使用自定义模板渲染该点,在Vs2012设计界面可以看到,但运行时出现异常

代码如下:

           <esri:Graphic x:Name="MyGrapic" >
<esri:Graphic.Geometry>
<esri:MapPoint X="120.198704" Y="35.957860" >
<esri:MapPoint.SpatialReference>
<esri:SpatialReference WKID=""/>
</esri:MapPoint.SpatialReference>
</esri:MapPoint>
</esri:Graphic.Geometry>
<esri:Graphic.Symbol>
<esri:MarkerSymbol>
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Image Source="Images\addvector.png"></Image>
</ControlTemplate>
</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>
</esri:Graphic.Symbol>
</esri:Graphic>

异常信息:

未处理System.ArgumentException
HResult=-
Message=图形符号无法序列化为 JSON
Source=ESRI.ArcGIS.Client
StackTrace:
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.GetSymbolJson(Graphic graphic)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.SerializeGraphic(Graphic graphic, Geometry displayGeometry, BinaryWriter output)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.<>c__DisplayClass6.<AddGraphics>b__5(BinaryWriter w)
在 ESRI.ArcGIS.Client.Utils.BinaryWriterExtensions.Write(Action` writeAction)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphics(IEnumerable` graphicGeometryPairs)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphics()
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.Initialize()
在 ESRI.ArcGIS.Client.NativeMap.AddLayer(Int32 index, Layer layer)
在 ESRI.ArcGIS.Client.DrawingSurface.AddLayer(Int32 index, Layer layer)
在 ESRI.ArcGIS.Client.DrawingSurface.FindIndexAndAddLayer(Layer layer, IList` collection)
在 ESRI.ArcGIS.Client.Map.TryAddLayerToDrawSurface(Layer layer)
在 ESRI.ArcGIS.Client.Map.layer_Initialized(Object sender, EventArgs e)
在 System.EventHandler`.Invoke(Object sender, TEventArgs e)
在 ESRI.ArcGIS.Client.Layer.OnInitialized(EventArgs e)
在 ESRI.ArcGIS.Client.Layer.Initialize()
在 ESRI.ArcGIS.Client.Map.OnApplyTemplate()
在 System.Windows.FrameworkElement.ApplyTemplate()
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
在 System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Border.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Window.MeasureOverrideHelper(Size constraint)
在 System.Windows.Window.MeasureOverride(Size availableSize)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Interop.HwndSource.SetLayoutSize()
在 System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
在 System.Windows.Window.SetRootVisualAndUpdateSTC()
在 System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
在 System.Windows.Window.CreateSourceWindow(Boolean duringShow)
在 System.Windows.Window.ShowHelper(Object booleanBox)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.DispatcherOperation.InvokeImpl()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Windows.Threading.DispatcherOperation.Invoke()
在 System.Windows.Threading.Dispatcher.ProcessQueue()
在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run()
在 ArcGISWpfApplication1.App.Main() 位置 e:\-LituGaoke\ProjectCode\2015Projects\IOS\IOS\obj\Debug\Application.g.cs:行号
在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
在 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:

官方Api也是这么写的:

http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html -  ESRI.ArcGIS.Client.Symbols Namespace : Symbol Class

         <esriSymbols:MarkerSymbol OffsetX="" OffsetY="">
<esriSymbols:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Border Width="" Height="" CornerRadius=""
BorderBrush="Black" BorderThickness=""
Background="Blue">
<Image Source="myImage.png" />
</Border>
</ControlTemplate>
</esriSymbols:MarkerSymbol.ControlTemplate>
</esriSymbols:MarkerSymbol>

有遇到了另一个问题,使用<esri:PictureMarkerSymbol.ControlTemplate>自定义PictureMarkerSymbol,报出“不支持所指定方法”,异常信息如下:

未处理System.NotSupportedException
HResult=-
Message=不支持所指定的方法。
Source=ESRI.ArcGIS.Client
StackTrace:
在 ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol.ToJsonInternal(Boolean nativeMapSerialization)
在 ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol.ESRI.ArcGIS.Client.IJsonSerializableNativeDisplay.ToNativeDisplayJson()
在 ESRI.ArcGIS.Client.JsonSerializableExtensions.SerializeToJson(Object o, Boolean nativeDisplay)
在 ESRI.ArcGIS.Client.SimpleRenderer.ToJsonInternal(Boolean nativeDisplay)
在 ESRI.ArcGIS.Client.SimpleRenderer.ESRI.ArcGIS.Client.IJsonSerializableNativeDisplay.ToNativeDisplayJson()
在 ESRI.ArcGIS.Client.JsonSerializableExtensions.SerializeToJson(Object o, Boolean nativeDisplay)
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.UpdateRenderer()
在 ESRI.ArcGIS.Client.Runtime.NativeGraphicsLayer.OnPropertyChanged(String propertyName)
在 ESRI.ArcGIS.Client.Runtime.NativeLayer.layer_PropertyChanged(Object sender, PropertyChangedEventArgs e)
在 System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
在 ESRI.ArcGIS.Client.Layer.OnPropertyChanged(String propertyName)
在 ESRI.ArcGIS.Client.GraphicsLayer.set_Renderer(IRenderer value)
在 IOS.MainWindow.LbxFuntion_OnSelectionChanged(Object sender, SelectionChangedEventArgs e) 位置 e:\-LituGaoke\ProjectCode\2015Projects\IOS\IOS\MainWindow.xaml.cs:行号
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.Controls.ListBox.OnSelectionChanged(SelectionChangedEventArgs e)
在 System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
在 System.Windows.Controls.Primitives.Selector.SetSelectedHelper(Object item, FrameworkElement UI, Boolean selected)
在 System.Windows.Controls.Primitives.Selector.NotifyIsSelectedChanged(FrameworkElement container, Boolean selected, RoutedEventArgs e)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.Controls.ListBoxItem.OnSelected(RoutedEventArgs e)
在 System.Windows.Controls.ListBoxItem.OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
在 System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
在 System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
在 System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
在 System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
在 System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
在 System.Windows.DependencyObject.SetCurrentValueInternal(DependencyProperty dp, Object value)
在 System.Windows.Controls.ListBox.NotifyListItemClicked(ListBoxItem item, MouseButton mouseButton)
在 System.Windows.Controls.ListBoxItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
在 System.Windows.Application.RunInternal(Window window)
在 System.Windows.Application.Run()
在 ArcGISWpfApplication1.App.Main() 位置 e:\-LituGaoke\ProjectCode\2015Projects\IOS\IOS\obj\Debug\Application.g.cs:行号
在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
在 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException:

ArcGIS Wpf MarkerSymbol 图形符号无法序列化为 JSON的更多相关文章

  1. ArcGIS 添加 MarkerSymbol 弹出“图形符号无法序列化为 JSON”错误

    今天在做一个demo,向自定义图层中添加MarkerSymbol的时候,弹出“图形符号无法序列化为 JSON”错误,之前都没有出现过这个问题,我们首先来看一看我是怎样去添加图层,然后向图层中添加Gra ...

  2. ArcGIS Runtime SDK for WPF之SimpleRenderer无法添加、报错“图形符号无法序列化为 JSON”

    ArcGIS Runtime SDK for WPF之SimpleRenderer无法添加.报错“图形符号无法序列化为 JSON” 在上一篇博文中如果在 esri:Map 里面是否设置了的UseAcc ...

  3. Jquery 将表单序列化为Json对象

    大家知道Jquery中有serialize方法,可以将表单序列化为一个“&”连接的字符串,但却没有提供序列化为Json的方法.不过,我们可以写一个插件实现. 我在网上看到有人用替换的方法,先用 ...

  4. 使用DataContractJsonSerializer类将类型实例序列化为JSON字符串和反序列化为实例对象 分类: JSON 前端 2014-11-10 10:20 97人阅读 评论(1) 收藏

    一.JSON简介 JSON(JavaScript Object Notation,JavaScript对象表示法)是一种轻量级的数据交换格式. JSON是"名值对"的集合.结构由大 ...

  5. jQuery表单验证以及将表单序列化为json对象小练习

    jquery表单验证(非实时验证),同时,将表单序列化为json对象提交表单. <!DOCTYPE html> <html lang="en"> <h ...

  6. JavaScriptSerializer类 对象序列化为JSON,JSON反序列化为对象

    JavaScriptSerializer 类由异步通信层内部使用,用于序列化和反序列化在浏览器和 Web 服务器之间传递的数据.说白了就是能够直接将一个C#对象传送到前台页面成为javascript对 ...

  7. 将Dictionary序列化为json数据 、json数据反序列化为Dictionary

    需要引用System.Web.Extensions  dll类库 /// <summary> /// 将json数据反序列化为Dictionary /// </summary> ...

  8. 类对象序列化为json串,json串反序列化为类对象

    1.类对象序列化为json串: 方法一: class P(object): def __init__(self,name,age,sex): self.name=name self.age=age s ...

  9. 将表单序列化为JSON对象

    将表单序列化为JSON对象的工具方法: $(function() { //工具方法,可以将指定的表单中的输入项目序列化为JSON数据 $.fn.serializeJson = function() { ...

随机推荐

  1. JS判断是否来自手机移动端的访问,并跳转

    var browserName_ = navigator.userAgent ; &&browserName_.indexOf(&&browserName_.index ...

  2. hdu3078 伪LCA……

    题意:有 n 点的一颗树,每个节点有格子的权值,现在有两种操作,修改一个点的权值,或者求两点之间的路径上的第 k 大的权值. 其实看到这个题,就在 YY 各种做法,询问后得到貌似可能是关于主席树.树链 ...

  3. JavaWeb用Jdbc操作MySql数据库(二)

    一.仍然使用前面的环境和示例数据库. 二.建立发出注册请求的页面index3.jsp. <%@ page language="java" import="java. ...

  4. Python 特殊语法:filter、map、reduce、lambda

    Python内置了一些特殊函数,这些函数很具python特性.可以让代码更加简洁. 可以看例子: 1 filter(function, sequence): str = ['a', 'b','c', ...

  5. AS2使用ExternalInterface

    以下代码是帧脚本(选中某帧F9,粘贴) import flash.external.ExternalInterface; // 假的,目的是为了执行createButton里面的ExternalInt ...

  6. eclipse 设置默认编码为Utf-8

    Window->Preferences->General ->Content Type->Text->JSP 最下面设置为UTF-8 Window->Prefere ...

  7. HackerRank "Square Subsequences" !!!

    Firt thought: an variation to LCS problem - but this one has many tricky detail. I learnt the soluti ...

  8. Apache Shiro 使用手册(一)Shiro架构介绍

    一.什么是Shiro Apache Shiro是一个强大易用的Java安全框架,提供了认证.授权.加密和会话管理等功能:  认证 - 用户身份识别,常被称为用户"登录": 授权 - ...

  9. 根据ip判断地区,IP接口

    大型网站提供的IP API接口调用方法 [淘宝]的IP地址查询接口:http://ip.taobao.com/service/getIpInfo.php?ip=218.192.3.42[新浪]的IP地 ...

  10. Linux-第一天

    1.etc 配置目录 2.swap 3.挂载点 建立一个目录,作为一个设备的访问入口,光盘镜像文件.移动硬盘.U盘以及Windows网络共享和UNIX NFS网络共享等 mnt目录, 建立挂载点:mn ...