Select to view content in your preferred language

Renderer on feature layer with behind code

787
1
01-12-2011 01:25 AM
MarcoRosa
Emerging Contributor
Hi to all,
i would like to set renderer on feature layer (poligons in this case) through behind code:
I have write this code ... doesn't work:

   SimpleRenderer sr = new SimpleRenderer();
   SimpleFillSymbol fillSymbol = new SimpleFillSymbol()
   {
       BorderBrush = new SolidColorBrush(Color.FromArgb(0, 255,255,255)),
       BorderThickness = 2,
       Fill = new SolidColorBrush(Color.FromArgb(0, 255,255,255))
    };
    sr.Symbol = fillSymbol;
    my_feature_layer.Renderer = sr;

instead if i use the xaml code for my_feature_layer this work fine

<Grid.Resources>
        <esri:SimpleRenderer x:Key="sr">
                <esri:SimpleRenderer.Symbol>
                    <symbols:SimpleFillSymbol BorderBrush="Blue" Fill="#330000FF"   />
                </esri:SimpleRenderer.Symbol>
            </esri:SimpleRenderer>
  </Grid.Resources>


Which is the difference ? it's necesary to have renderer defined inside grid resouces first ?
Thank's everyone help me.

Bye GP
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor

BorderBrush = new SolidColorBrush(Color.FromArgb(0, 255,255,255)),
BorderThickness = 2,
Fill = new SolidColorBrush(Color.FromArgb(0, 255,255,255))


You are using fully transparent colors.
Try with 'FromArgb(255, 255,255,255))'
0 Kudos