Templating a dynamic TextSymbol

661
0
01-16-2014 11:51 AM
CW
by
New Contributor
Some labels set as TextSymbol like;

if (the.Attributes[LabelGraphic] != null)
            {
                var graphic = the.Attributes[LabelGraphic] as Graphic;

                var symbol = graphic.Symbol as TextSymbol;

                symbol.Text = the.Attributes["POW"].ToString();

                labbelsLayer.Graphics.Add(graphic);

            }


what I'm trying to do is specify a control template to style this bugger on the presentation side, something like

<esri:TextSymbol x:Key="theSymbol">
         <esri:TextSymbol.ControlTemplate>
          <ControlTemplate>
           <Border Background="White" Padding="10">
            <TextBlock Text="{Binding symbol.Text}"/>
     </Border>
    </ControlTemplate>      
   </esri:TextSymbol.ControlTemplate>
        </esri:TextSymbol>


I tried to do something like;

TextSymbol = LayoutRoot.Resources["theSymbol"] as TextSymbol;


but no joy, maybe I'm not forming correctly? Any advice or tips?
0 Kudos
0 Replies