Arrow in LineSymbol WPF API

4464
3
04-16-2013 06:13 AM
Labels (1)
foxfire
New Contributor
Help please. I'm using ArcGis WPF API for paint schemes on the map. I need to draw lines with arrows. Is this possible and how to do it? For drawing I use ESRI.ArcGIS.Client.Draw.
0 Kudos
3 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

You could consider extending the Draw class - see this example: Custom Draw Tool

Cheers

Mike

0 Kudos
BrianLocke
Occasional Contributor II

Pretty sure that I saw the new .net SDK come with an Arrow type?

0 Kudos
JenniferNery
Esri Regular Contributor

Hi,

I'm not sure if you simply want to update symbol template to include an arrow or if you wanted an arrow shape.

For custom symbols, you can try this SDK sample: ArcGIS API for Silverlight - Interactive Samples | ArcGIS for Developers  or symbol gallery: ArcGIS API for Silverlight - Symbol Gallery. Basically, you will need a LineSymbol and define a Control Template that includes an Arrow Shape.

If you want an arrow shape, you can try this SDK sample: ArcGIS API for Silverlight - Interactive Samples | ArcGIS for Developers click on the button with "Add an arrow" tooltip and then mouse down + drag + up to create this shape.

arrowshape.png

By default, this creates a Polygon but you can subscribe to DrawComplete and convert to Polyline.

        void Button_Click(object sender, RoutedEventArgs e)

        {

            var draw = new Draw(MyMap);

            draw.DrawMode = DrawMode.Arrow;

            draw.DrawComplete += draw_DrawComplete;

            draw.IsEnabled = true;

        }

        void draw_DrawComplete(object sender, DrawEventArgs e)

        {          

           ((Draw)sender).DrawComplete -= draw_DrawComplete;

            var polygon = (Polygon)e.Geometry;

            var polyline = new Polyline() { SpatialReference = polygon.SpatialReference };

            foreach (var r in polygon.Rings)

                polyline.Paths.Add(r);

            var layer = MyMap.Layers["MyLayer"] as GraphicsLayer;

            layer.Graphics.Add(new Graphic() { Geometry = polyline, Symbol = new SimpleLineSymbol() });           

        }

0 Kudos