Add using XAML
This sample demonstrates adding graphics to the map using XAML. Simple marker symbols, picture marker symbols, simple line symbols, cartographic line symbols, simple fill symbols, and picture fill symbols are shown.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalAddGraphicsXAML" 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:PictureMarkerSymbol x:Key="PinPictureMarkerSymbol" OffsetX="11" OffsetY="39" Source="/Assets/Images/i_pushpin.png" /> <esri:PictureMarkerSymbol x:Key="GlobePictureMarkerSymbol" OffsetX="8" OffsetY="8" Source="/Assets/Images/globe-16x16.png" /> <esri:SimpleLineSymbol x:Key="RedLineSymbol" Color="Red" Width="4" Style="Solid" /> <esri:CartographicLineSymbol x:Key="CartoLineSymbol" Color="Green" Width="4" DashCap="Triangle" DashArray="5 1" /> <esri:SimpleFillSymbol x:Key="RedFillSymbol" Fill="#66FF0000" BorderBrush="Red" BorderThickness="2" /> <esri:PictureFillSymbol x:Key="GlobePictureFillSymbol" Source="/Assets/Images/globe-16x16.png" /> </Grid.Resources> <esri:Map x:Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" MinimumResolution="2445.98490512499"> <esri:ArcGISLocalTiledLayer ID="myBaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/> <esri:GraphicsLayer ID="MyGraphics" > <esri:GraphicsLayer.Graphics > <esri:Graphic Symbol="{StaticResource RedMarkerSymbol}" > <esri:MapPoint X="-12735945" Y="5535654" /> </esri:Graphic> <esri:Graphic Symbol="{StaticResource PinPictureMarkerSymbol}" > <esri:MapPoint X="-9780783" Y="4014054" /> </esri:Graphic> <esri:Graphic Symbol="{StaticResource GlobePictureMarkerSymbol}" > <esri:MapPoint X="-11732579" Y="3310988" /> </esri:Graphic> <esri:Graphic> <esri:Graphic.Symbol> <esri:TextSymbol FontFamily="Arial" FontSize="14" Foreground="Black" Text="My Text" /> </esri:Graphic.Symbol> <esri:MapPoint X="-12404164" Y="6354110" /> </esri:Graphic> <esri:Graphic Symbol="{StaticResource RedLineSymbol}" > <esri:Polyline > <esri:Polyline.Paths> <esri:PointCollection> <esri:MapPoint X="-9984423" Y="4738107" /> <esri:MapPoint X="-11806033" Y="4790575" /> <esri:MapPoint X="-11554189" Y="4895310" /> <esri:MapPoint X="-11281357" Y="5000445" /> <esri:MapPoint X="-11071487" Y="5136861" /> </esri:PointCollection> </esri:Polyline.Paths> </esri:Polyline> </esri:Graphic> <esri:Graphic Symbol="{StaticResource CartoLineSymbol}" > <esri:Polyline > <esri:Polyline.Paths> <esri:PointCollection> <esri:MapPoint X="-11759451" Y="5535653" /> <esri:MapPoint X="-11495491" Y="7141124" /> <esri:MapPoint X="-12295491" Y="7251124" /> <esri:MapPoint X="-13095491" Y="7361124" /> <esri:MapPoint X="-13595491" Y="7481124" /> <esri:MapPoint X="-14595491" Y="7591124" /> </esri:PointCollection> </esri:Polyline.Paths> </esri:Polyline> </esri:Graphic> <esri:Graphic Symbol="{StaticResource RedFillSymbol}"> <esri:Polygon > <esri:Polygon.Rings> <esri:PointCollection> <esri:MapPoint X="-10095589" Y="6616448" /> <esri:MapPoint X="-7797507" Y="6490526" /> <esri:MapPoint X="-8385145" Y="5147355" /> <esri:MapPoint X="-10641252" Y="5136861" /> <esri:MapPoint X="-10095589" Y="6616448" /> </esri:PointCollection> </esri:Polygon.Rings> </esri:Polygon> </esri:Graphic> <esri:Graphic Symbol="{StaticResource GlobePictureFillSymbol}"> <esri:Polygon > <esri:Polygon.Rings> <esri:PointCollection> <esri:MapPoint X="-13610919" Y="8242944" /> <esri:MapPoint X="-12330709" Y="8326892" /> <esri:MapPoint X="-12162813" Y="7739253" /> <esri:MapPoint X="-13505984" Y="7781229" /> <esri:MapPoint X="-13610919" Y="8242944" /> </esri:PointCollection> </esri:Polygon.Rings> </esri:Polygon> </esri:Graphic> </esri:GraphicsLayer.Graphics> </esri:GraphicsLayer> </esri:Map> </Grid> </UserControl>
5/16/2014