AnsweredAssumed Answered

layer.Graphics not there

Question asked by scottrowles on Jan 8, 2016
Latest reply on Jan 14, 2016 by akajanus-esristaff

Hi,

 

I have a WinForms application in VS 2013.  I have referenced the arcgisruntime and can create a graphics layer in the mapcontrol, but the GraphicsLayer that I am creating isn't showing a binding for the Graphics property of the layer for me to add Points, Lines and Polygons.

using System;

using System.Collections.Generic;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

 

 

using Esri.ArcGISRuntime.Controls;

using Esri.ArcGISRuntime.Layers;

using Esri.ArcGISRuntime.Symbology;

using Esri.ArcGISRuntime.Geometry;

 

 

using HB.Core.Inventory;

using HB.Core.Tasking;

 

-----other methods here

 

 

        private Boolean DrawLocations()

        {

            try

            {

          

                //Draw All Locations

                Layer layer = new Esri.ArcGISRuntime.Layers.GraphicsLayer();

                layer.ID = "Locations";

                layer.DisplayName = "Locations";

                mapControl.Map.Layers.Add(layer);

 

 

                foreach (Location location in Data.GetLocations())

                {

                    Esri.ArcGISRuntime.Geometry.MapPoint point = new MapPoint(location.Point.X, location.Point.Y, location.Point.Z);

                    Esri.ArcGISRuntime.Symbology.SimpleMarkerSymbol symbol = new SimpleMarkerSymbol();

                    Esri.ArcGISRuntime.Layers.Graphic graphic = new Graphic(point, symbol);

                    layer.Graphics.Add(graphic);

                }

 

 

                return true;

            }

            catch (Exception ex)

            {

                throw new Exception("Unable to Draw Locations.", ex);

            }

        }

 

Any help would be appreciated!

 

scott

Outcomes