I am currently using IUnique value renderer like this:
foreach (string nodeType in nodes)
yield return new KeyValuePair<string, ISymbol>(nodeType, CreateNewSymbol() );
public static ISimpleLineSymbol CreateSimpleLineSymbol(IRgbColor rgbColor, Double width, esriSimpleLineStyle style)
{
SimpleLineSymbolClass simpleLineSymbol = new SimpleLineSymbolClass();
simpleLineSymbol.Color = rgbColor;
simpleLineSymbol.Style = style;
simpleLineSymbol.Width = width;
return simpleLineSymbol;
}
finally this is called during creation of the layer:
/// <summary>
/// Set's the unique symbol types on the feature layer
/// </summary>
/// <param name="featureLayer"></param>
/// <param name="layerType"></param>
public static void SetFeatureLayerSymbols(IFeatureLayer featureLayer, IEnumerable<KeyValuePair<string, ISymbol>> layerSymbols)
{
IFields fields = featureLayer.FeatureClass.Fields;
//Get indexes of certain fields
int id = fields.FindField("TYPE");
IUniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer();
//The fields which are used to map to the symbol
uniqueValueRenderer.FieldCount = 1;
uniqueValueRenderer.set_Field(0, "TYPE");
foreach (KeyValuePair<string, ISymbol> values in layerSymbols)
uniqueValueRenderer.AddValue(values.Key, null, values.Value);
if (uniqueValueRenderer.ValueCount > 0)
(featureLayer as IGeoFeatureLayer).Renderer = uniqueValueRenderer as IFeatureRenderer;
}
I can see the index in the TOC showing the proper unique values and the colors, but on the map it is invisible, I CAN HOWEVER HIGHLIGHT IT.
Thanks and Regards,