The code for drawing the Line in the DrawCompleted Event is
if (drawVertex1 && drawObject.DrawMode==DrawMode.LineSegment)
{
GraphicsLayer gp = GetOrCreateGraphicsLayer("MyGraphicsLayer");
if (this.selectedGraphic.Count == 1)
{
targetID = selectedGraphic.ElementAt(0).Attributes["NAME"].ToString();
}
var pipeSymbol =new SimpleLineSymbol() { Style = SimpleLineSymbol.LineStyle.Solid, Color = Brushes.Red, Width = 2 };
viewMap.Cursor = Cursors.Arrow;
Graphic g = new Graphic();
g.Attributes["GraphicId"] = GraphicsCollection.Count;
g.Attributes["SourceID"] = sourceID; //Start graphic
g.Attributes["TargetID"] = targetID; //EndGraphic
g.Attributes["TYPE"] = "XX";
g.Geometry = e.Geometry;
g.Symbol = pipeSymbol;
g.Geometry.SpatialReference = new SpatialReference(102100);
GraphicsCollection.Add(g);
drawObject.IsEnabled = false;
drawVertex1 = false;
return;
}
The Graphics at the end points are Point graphics but have control templates defined as follows:
<esri:SimpleMarkerSymbol x:Key="StartSymbol">
<esri:SimpleMarkerSymbol.ControlTemplate>
<ControlTemplate>
<Grid>
<!-- Marker -->
<StackPanel Orientation="Vertical">
<Canvas>
<Ellipse Width="30" Height="15" />
<Path Width="30"
Height="15"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Data="M 435.782,256.9C 410.699,256.9 390.365,244.15 390.365,228.421C 390.365,212.693 410.699,199.942 435.782,199.942M 585.239,199.942C 610.322,199.942 630.656,212.692 630.656,228.421C 630.656,244.149 610.322,256.9 585.239,256.9M 436.489,200.001L 585.822,200.001L 585.822,257.335L 436.489,257.335L 436.489,200.001 Z "
Fill="Azure"
Stretch="Fill"
Stroke="Black"
StrokeLineJoin="Round" />
</Canvas>
<TextBlock FontSize="12"
FontWeight="Bold"
Foreground="Black"
Text="{Binding Attributes[NAME]}" />
</StackPanel>
</Grid>
</ControlTemplate>
</esri:SimpleMarkerSymbol.ControlTemplate>
</esri:SimpleMarkerSymbol>