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

在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. WorldChat.lua --世界聊天

    print(">>Script: Wolrd Chating.") local SAY=" "--普通聊天 --联盟阵营 --部落阵营 local ...

  2. 修改pc机的mac地址 以及 mac地址的组成

    在"开始"菜单的"运行"中输入regedit,打开注册表编辑器,展开注册表到:HKEY_LOCAL_ MACHINE/System/CurrentControl ...

  3. 基于MVC4+EasyUI的Web开发框架形成之旅--框架总体界面介绍

    在前面介绍了一些关于最新基于MVC4+EasyUI的Web开发框架文章,虽然Web开发框架的相关技术文章会随着技术的探讨一直写下去,不过这个系列的文章,到这里做一个总结,展示一下整体基于MVC4+Ea ...

  4. protobuf 数据解析的2种方法

    方法1: message person{required int32 age = 1;required int32 userid = 2;optional string name = 3;} mess ...

  5. 完成一段简单的Python程序,用于实现一个简单的加减乘除计算器功能

    #!/bin/usr/env python#coding=utf-8'''完成一段简单的Python程序,用于实现一个简单的加减乘除计算器功能'''try: a=int(raw_input(" ...

  6. Maven学习3-使用Maven构建项目

    转自:http://www.cnblogs.com/xdp-gacl/p/4240930.html maven作为一个高度自动化构建工具,本身提供了构建项目的功能,下面就来体验一下使用maven构建项 ...

  7. 线下线上对接的一种思路(本地erp与线上电子商务平台对接)

    目前很多公司都希望本地的ERP能够与线上的电子商务平台进行对接. 但是很多的线下ERP系统商不愿意修改代码来做相应的对接,或者觉得太话费成本. 而对于企业本身,又会有很多的特殊需求. 下面略述一家进口 ...

  8. bzoj3822: 文学

    Description 巨酱和主席是一对好朋友.他们都很喜欢读书,经常一起阅读相关领域书籍,进行系统的学习.一天主席列出了一份列表,里面共 p 本书,其中不乏<约翰克里斯多夫>,<名 ...

  9. Android总结篇系列:Activity生命周期

    Android官方文档和其他不少资料都对Activity生命周期进行了详细介绍,在结合资料和项目开发过程中遇到的问题,本文将对Activity生命周期进行一次总结. Activity是由Activit ...

  10. Eclipse集成javap查看字节码

    分析java语言特性的一个好帮手是使用javap工具查看java编译后的字节码,楼主今天在学习java泛型中的桥方法时遇到一些不解,想到javap这个好工具可以帮助解答一些疑惑,索性就捣鼓如何在ecl ...