I thought I'd seen a fix for this last week in the forums but can't find it today! I'm trying to add a graphic to a graphics layer using an image defined in Resources of my user control but if I use a PictureMarkerSymbol nothing draws whereas a SimpleMarkerSymbol does. The ESRI Identify sample uses a PictureMarkerSymbol so I know it's possible. I have a user control that a user can enter a Lat-Long and the map will zoom to it and (should) add a graphic at the local they entered. I'm wondering if it's a location issue - my control is /UserControls/ZoomToXY and references a PNG in /UserControls/Images as the source for the PictureMarkerSymbol. I've tried putting the PNG up a level in the /Images folder but that doesn't seem to solve the problem either. Anyone know what I'm missing? Thanks, TerryXAML for resources:
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.Resources>
<esri:PictureMarkerSymbol x:Name="DefaultPictureSymbol" OffsetX="13" OffsetY="22"
Source="/Images/IdentifyMapIcon.png" />
<esri:SimpleMarkerSymbol x:Name="SMStest" Color="Red" Size="12" />
</Grid.Resources>
Code behind:
//add graphic to map
GraphicsLayer graphicsLayer = (GraphicsLayer)_Map.Layers[_GraphicsLayer];
graphicsLayer.ClearGraphics();
//this does not work
Graphic graphic = new Graphic() { Geometry = ptMapPoint, Symbol = DefaultPictureSymbol };
graphicsLayer.Graphics.Add(graphic);
//using a SimpleMarkerSymbol works
Graphic graphic2 = new Graphic() { Geometry = ptMapPoint, Symbol = SMStest };
graphicsLayer.Graphics.Add(graphic2);