The following C# code works when drawing in Point mode, but not Polyline . . .
// "Draw" is ESRI.ArcGIS.Client.Draw object
_draw = new Draw(_map);
_draw.DrawMode = DrawMode.Polyline;
_draw.DrawComplete += (senderObject, drawEventArgs) =>
{
_barrierLine = new Graphic();
_barrierLine.Symbol = this.Resources["LineSymbol"] as SimpleLineSymbol;
_barrierLine.Geometry = drawEventArgs.Geometry;
_lineGraphicsLayer.Graphics.Add(_barrierLine);
};
This is what the XML code looks like (I tried several different methods):
<Window.Resources>
<esri:SimpleMarkerSymbol x:Key="PointSymbol" Color="DarkViolet" Size="15" Style="Diamond"></esri:SimpleMarkerSymbol>
<esri:SimpleLineSymbol x:Key="LineSymbol" Color="Aqua" Width="5" Style="Solid"></esri:SimpleLineSymbol>
</Window.Resources>
<Grid>
<Grid.Resources>
<esri:SimpleMarkerSymbol x:Key="RedMarkerSymbol" Color="Red"/>
<esri:SpatialReference x:Key="theSpatialReference" WKID="4326"/>
<esri:SimpleLineSymbol x:Key="LineSymbol" Color="Aqua" Width="3" Style="Solid"/>
</Grid.Resources>
<!--Graphics Layer-->
<esri:GraphicsLayer ID="graphicsLayer" x:Name="_graphicsLayer">
<esri:Graphic>
<esri:Graphic.Symbol>
<esri:SimpleMarkerSymbol Style="Circle" Color="Red"/>
</esri:Graphic.Symbol>
<esri:Graphic.Geometry>
<esri:MapPoint X="0" Y="0" >
<esri:MapPoint.SpatialReference>
<esri:SpatialReference WKID="4326"/>
</esri:MapPoint.SpatialReference>
</esri:MapPoint>
</esri:Graphic.Geometry>
</esri:Graphic>
</esri:GraphicsLayer>
<esri:GraphicsLayer ID="lineGraphicsLayer" x:Name="_lineGraphicsLayer">
<esri:Graphic>
<esri:Graphic.Symbol>
<esri:SimpleLineSymbol Style="Solid" Color="Aqua" Width="3" />
</esri:Graphic.Symbol>
<esri:Graphic.Geometry>
<esri:Polyline>
<esri:Polyline.SpatialReference>
<esri:SpatialReference WKID="4326"/>
</esri:Polyline.SpatialReference>
</esri:Polyline>
</esri:Graphic.Geometry>
</esri:Graphic>
</esri:GraphicsLayer>
</esri:Map>
<StackPanel Orientation="Vertical" HorizontalAlignment="Left">
<Button Content="Stops" VerticalAlignment="Top" Name="StopsButton" Margin="5,5,5,0" Click="StopsButton_Click" />
<Button Content="Point Barriers" Height="23" Name="PointBarriersButton" Width="76" Click="PointBarriersButton_Click" />
<Button Content="Solve" Name="SolveButton" Margin="5,5,5,0" Click="SolveButton_Click" />
<Button Content="Line Barriers" Height="23" Name="LineBarriersButton" Width="76" Click="LineBarriersButton_Click" />
</StackPanel>
</Grid>