"Problem sticker, still don't know how to solve"
Add a point in Graphicslayer, render the point using a custom template, as you can see in the Vs2012 design interface, but at run time an exception occurs
The code is as follows:
1<esri:graphic x:name="Mygrapic">2<esri:Graphic.Geometry>3<esri:mappoint x="120.198704"y="35.957860">4<esri:MapPoint.SpatialReference>5<esri:spatialreference wkid="4326"/>6</esri:MapPoint.SpatialReference>7</esri:MapPoint>8</esri:Graphic.Geometry>9<esri:Graphic.Symbol>Ten<esri:MarkerSymbol> One<esri:MarkerSymbol.ControlTemplate> A<ControlTemplate> -<image source="Images\addvector.png"></Image> -</ControlTemplate> the</esri:MarkerSymbol.ControlTemplate> -</esri:MarkerSymbol> -</esri:Graphic.Symbol> -</esri:Graphic>
Exception information:
System.argumentexceptionhresult not processed=-2147024809Message=graphic symbols cannot be serialized as Jsonsource=ESRI. Arcgis.clientstacktrace: at ESRI. ArcGIS.Client.Runtime.NativeGraphicsLayer.GetSymbolJson (Graphic Graphic) at ESRI. ArcGIS.Client.Runtime.NativeGraphicsLayer.SerializeGraphic (Graphic Graphic, Geometry displaygeometry, BinaryWriter Output) at ESRI. ArcGIS.Client.Runtime.NativeGraphicsLayer.<>c__DisplayClass6.<AddGraphics>b__5 (BinaryWriter W) at ESRI. ArcGIS.Client.Utils.BinaryWriterExtensions.Write (Action '1writeaction) at ESRI. ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphics (IEnumerable '1graphicgeometrypairs) at ESRI. ArcGIS.Client.Runtime.NativeGraphicsLayer.AddGraphics () at ESRI. ArcGIS.Client.Runtime.NativeGraphicsLayer.Initialize () at ESRI. ArcGIS.Client.NativeMap.AddLayer (Int32 index, layer layer) at ESRI. ArcGIS.Client.DrawingSurface.AddLayer (Int32 index, layer layer) at ESRI. ArcGIS.Client.DrawingSurface.FindIndexAndAddLayer (layer layer, IList '1collection) at ESRI. ArcGIS.Client.Map.TryAddLayerToDrawSurface (layer layer) at ESRI. ArcGIS.Client.Map.layer_Initialized (Object sender, EventArgs e) in System.EventHandler '1. Invoke (Object sender, Teventargs e) at ESRI. ArcGIS.Client.Layer.OnInitialized (EventArgs e) at ESRI. ArcGIS.Client.Layer.Initialize () at ESRI. ArcGIS.Client.Map.OnApplyTemplate () in System.Windows.FrameworkElement.ApplyTemplate () in System.Windows.FrameworkElement.MeasureCore (Size availablesize) in System.Windows.UIElement.Measure (size availablesize) in System.Windows.Controls.Grid.MeasureOverride (Size constraint) in System.Windows.FrameworkElement.MeasureCore (Size availablesize) in System.Windows.UIElement.Measure (size availablesize) in System.Windows.Controls.Grid.MeasureOverride (Size constraint) in System.Windows.FrameworkElement.MeasureCore (Size availablesize) in System.Windows.UIElement.Measure (size availablesize) in MS. Internal.Helper.MeasureElementWithSingleChild (UIElement element, Size constraint) in System.Windows.Controls.ContentPresenter.MeasureOverride (Size constraint) in System.Windows.FrameworkElement.MeasureCore (Size availablesize) in System.Windows.UIElement.Measure (size availablesize) in SYSTEM.WINDOWS.DOcuments. Adornerdecorator.measureoverride (Size constraint) in System.Windows.FrameworkElement.MeasureCore (size availablesize ) in System.Windows.UIElement.Measure (size availablesize) in System.Windows.Controls.Border.MeasureOverride (size Constraint) in System.Windows.FrameworkElement.MeasureCore (Size availablesize) in System.Windows.UIElement.Measure ( Size availablesize) in System.Windows.Window.MeasureOverrideHelper (size constraint) in System.Windows.Window.MeasureOverride (Size availablesize) in System.Windows.FrameworkElement.MeasureCore (size availablesize) in System.Windows.UIElement.Measure (Size availablesize) in System.Windows.Interop.HwndSource.SetLayoutSize () in System.Windows.Interop.HwndSource.set_RootVisualInternal ( Visual value) in System.Windows.Window.SetRootVisualAndUpdateSTC () in System.Windows.Window.SetupInitialState (Double Requestedtop, double requestedleft, double requestedwidth, double requestedheight) in System.Windows.Window.CreateSourceWindow (Boolean duringshow) in System.Windows.Window.ShowHelpER (object booleanbox) in System.Windows.Threading.ExceptionWrapper.InternalRealCall (Delegate callback, Object args, Int32 Numargs) in MS. Internal.Threading.ExceptionFilterHelper.TryCatchWhen (Object source, Delegate method, Object args, Int32 Numargs, Delegate Catchhandler) in System.Windows.Threading.DispatcherOperation.InvokeImpl () in System.Threading.ExecutionContext.RunInternal (ExecutionContext ExecutionContext, ContextCallback callback, Object State, Boolean Preservesyncctx) in System.Threading.ExecutionContext.Run (ExecutionContext ExecutionContext, ContextCallback Callback, Object State, Boolean Preservesyncctx) in System.Threading.ExecutionContext.Run ( ExecutionContext ExecutionContext, ContextCallback callback, Object State) in System.Windows.Threading.DispatcherOperation.Invoke () in System.Windows.Threading.Dispatcher.ProcessQueue () in System.Windows.Threading.Dispatcher.WndProcHook (IntPtr hwnd, Int32 msg, IntPtr WParam, IntPtr LParam, Boolean&handled) in MS. Win32.HwndWrapper.WndProc (IntPtr hwnd, Int32 msg, IntPtr WParam, IntPtr lParam, Boolean&handled) in MS. Win32.HwndSubclass.DispatcherCallbackOperation (Object o) in System.Windows.Threading.ExceptionWrapper.InternalRealCall (Delegate callback, Object args, Int32 Numargs) in MS. Internal.Threading.ExceptionFilterHelper.TryCatchWhen (Object source, Delegate method, Object args, Int32 Numargs, Delegate Catchhandler) in System.Windows.Threading.Dispatcher.LegacyInvokeImpl (DispatcherPriority priority, TimeSpan Timeout, Delegate method, Object args, Int32 Numargs) in MS. Win32.HwndSubclass.SubclassWndProc (IntPtr hwnd, Int32 msg, IntPtr WParam, IntPtr lParam) in MS. Win32.UnsafeNativeMethods.DispatchMessage (MSG&msg) in System.Windows.Threading.Dispatcher.PushFrameImpl (DispatcherFrame frame) in System.Windows.Application.RunInternal (Window window) in System.Windows.Application.Run () ArcGISWpfApplication1.App.Main () Location e:\1-litugaoke\projectcode\2015projects\ios\ios\obj\debug\application.g.cs: Line number0in system.appdomain._nexecuteassembly (runtimeassembly Assembly, string[] args) in System.Runtime.Hosting.ApplicationActivator.CreateInstance (ActivationContext activationcontext, string[] Activationcustomdata) in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone () in System.Threading.ExecutionContext.RunInternal (ExecutionContext ExecutionContext, ContextCallback callback, Object State, Boolean Preservesyncctx) in System.Threading.ExecutionContext.Run (ExecutionContext ExecutionContext, ContextCallback Callback, Object State, Boolean Preservesyncctx) in System.Threading.ExecutionContext.Run ( ExecutionContext ExecutionContext, ContextCallback callback, Object State) in System.Threading.ThreadHelper.ThreadStart () innerexception:
The official API is also written like this:
Http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html-ESRI. ArcGIS.Client.Symbols Namespace:symbol Class
<esrisymbols:markersymbol offsetx="Ten"offsety="Ten"> <esriSymbols:MarkerSymbol.ControlTemplate> <ControlTemplate> <border width=" -"height=" -"cornerradius="3"BorderBrush="Black"borderthickness="1"Background="Blue"> <image source="Myimage.png"/> </Border> </ControlTemplate> </esrisymbols:markersymbol. Controltemplate> </esriSymbols:MarkerSymbol>
ArcGIS WPF Markersymbol Graphics symbols cannot be serialized as JSON