Select to view content in your preferred language

PictureMarkerSymbol does not display

810
4
10-18-2010 11:41 AM
ShaningYu
Honored Contributor
In an application, everything works fine except for the PictureMarkerSymbol defined, which does not display on the map.  My code is below:
    <Grid Name="LayoutRoot" Background="Transparent">
        <Grid.Resources>
            <esri:PictureMarkerSymbol x:Key="DefaultMarkerSymbol"
                OffsetX="0" OffsetY="31" Source="/UserControls/Images/i_pushpin.png" />
        </Grid.Resources>

I tried either  Source="/UserControls/Images/i_pushpin.png"  or  Source="UserControls/Images/i_pushpin.png"  but none of them works.  The folder /UserControls/ is under the project.  Is anything incorrect in the path?
0 Kudos
4 Replies
AliMirzabeigi
Emerging Contributor
The path you are using for your picture marker symbol is relative to the location of XAP file for the application. Make sure the path for your image exists.
0 Kudos
ShaningYu
Honored Contributor
ali5110:  I found the xap file in ClindBin folder.  However it is in binary format.  What Can I do for it?
I also checked the path.  I also have many other image files and all of them are in the same folder as specified as 'UserControls/Images/xxx.png'

In my xaml file, I add the image as icon on the dialog box:
        <Image Source="/UnBlendedCS1_Oct1;component/UserControls/Images/i_pushpin.png" ...
and it works.  However there is no display for the one to be added on the map:
        <Grid.Resources>
            <esri:PictureMarkerSymbol x:Key="DefaultMarkerSymbol"
                OffsetX="0" OffsetY="31" Source="/UnBlendedCS_Oct; component/UserControls/Images/i_pushpin.png" />
        </Grid.Resources>
Both are idential in the path.  But one is for Image control and another is for PictureMarkerSymbol.
In ESRI's ource code in http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#AddressToLocation
it is defined as
        <Grid.Resources>
            <esri:PictureMarkerSymbol x:Key="DefaultMarkerSymbol"
                OffsetX="0" OffsetY="31" Source="/Assets/images/flag-yellow-32x32.png" />          
        </Grid.Resources>
Could you take a look again?  Thanks.
0 Kudos
JenniferNery
Esri Regular Contributor
If you are able to see the image using Image, I don't see why you would not be able to see the PictureMarkerSymbol.

Debug through your code to see if the graphic with PictureMarkerSymbol is actually added to your layer.

Or try to test this way, add the following lines to your GraphicsLayer definition in XAML. If you see this, maybe something else is wrong in the code-behind when you retrieve the Symbol.
               <esri:GraphicsLayer.Graphics >

                        <esri:Graphic Symbol="{StaticResource DefaultMarkerSymbol}" >
                            <esri:MapPoint X="-140.9" Y="63.391" />
                        </esri:Graphic>

               </esri:GraphicsLayer.Graphics >

0 Kudos
ShaningYu
Honored Contributor
Jenniffer:
Thanks for your response.  I found that the problem was that I did add the graphics layer onto the map.  No the problem has been solved.
Thanks again.
Shaning
0 Kudos