Add using code Online

This sample demonstrates adding graphics to the map using code. Simple marker symbols, picture marker symbols, simple line symbols, and simple fill symbols are shown.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.AddGraphics"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot" Background="White">

        <Grid.Resources>
            <esri:SimpleMarkerSymbol x:Key="RedMarkerSymbol" Color="Red" Size="12" Style="Circle" />
            <esri:SimpleMarkerSymbol x:Key="BlackMarkerSymbol" Color="Black" Size="14" Style="Diamond" />
            <esri:PictureMarkerSymbol x:Key="GlobePictureSymbol" OffsetX="8" OffsetY="8" 
                Source="/Assets/Images/globe-16x16.png" />
            <esri:SimpleLineSymbol x:Key="DefaultLineSymbol" Color="Green" Style="DashDot" Width="4" />
            <esri:SimpleFillSymbol x:Key="DefaultFillSymbol" Fill="Green" BorderBrush="Blue" 
                BorderThickness="3" />
        </Grid.Resources>

        <esri:Map x:Name="MyMap" Background="White" WrapAround="True">
            <esri:ArcGISTiledMapServiceLayer ID="PhysicalTiledLayer" 
                      Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
            <esri:GraphicsLayer ID="MyGraphicsLayer" />
        </esri:Map>

    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014