I am using ArcGIS WPF's Polyline to plot several lines (PointCollections). Adding a Path(PointCollection) looks something like this.

PointCollection collection = new PointCollection();
PolyLine myLine = new PolyLine();



PolyLine is a Geometry in which I can set to a Graphic and plot on a map. Once that Graphic is clicked it of course is clicking the entire graphic. I am visually showing several Paths(PointCollections). Is it possible to figure out which Path is being clicked on from the user?


I have a solution now where I just have 1 PointCollection per PolyLine. So I am adding one PolyLine/Graphic for each line. I would rather not do this if I can avoid it.

1 Answer 1


If you have one Path per Polyline you can do something like this:

private void map1_MouseClick(object sender, Map.MouseEventArgs e)
            if (map1.Layers["MyGraphicsLayer"] is GraphicsLayer)
                GraphicsLayer glayer = (GraphicsLayer)map1.Layers["MyGraphicsLayer"];
                IEnumerable<Graphic> graphics = glayer.FindGraphicsInHostCoordinates(map1.MapToScreen(e.MapPoint));

                foreach (var graphic in graphics)
                //Do stuff

But if you want to use several Paths per Polyline I guess you have to look at catching the polyline that gets clicked and split that polyline into several polylines and use the GeometryService to do some relation operations on these.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.