Labels on GraphicsLayer

500
1
01-17-2013 06:44 AM
LuisGarcia2
Occasional Contributor II
I have a GraphicsLayer where I display a series of locations on the map. I'd like to add labels (no tips) to those points on the map like shown in the attached picture. The graphics used for the labels don't have to be exactly like that though. We just want something that helps identify those locations on the map. How can I do that? I am working with release 2.4. Thanks!
0 Kudos
1 Reply
ChrisTallman
New Contributor III
You will want you make your symbol marker look something like this.

<esri:MarkerSymbol x:Key="SymbolIDName" OffsetX="15" OffsetY="28">
  <esri:MarkerSymbol.ControlTemplate>
    <ControlTemplate>
      <Canvas Width="35" Height="35">
   <Image Source="ImageSource" Width="30" Height="30"/>
   <TextBlock Foreground="White" Canvas.Top="-8.5" Canvas.Left="22" Text="{Binding Attributes[LabelAttribute]}" />
      </Canvas>
    </ControlTemplate>
  </esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>


If you don't want to use an Image just replace that code with whatever element you want.  If you want a box around the text, enclose it in a border with a background.  The line pointing to the point can be done it could be a bit difficult to get it to look right.  Just included it inside the canvas control and you should be set.

Hope this helps.
Chris
0 Kudos