How to add a value to a unique value renderer programatically?

574
3
09-26-2011 02:36 PM
GregRieck
Occasional Contributor III
Hello,

Does anyone have some sample code or can point me to the ArcObjects needed for adding a new value to a unique value renderer?

I have a layer displaying with a categorized unique value and I would like to programmatically add new values to the list as they are created. I'd like the new values to use a random color from the same color ramp being used by the existing list of unique values.

G
0 Kudos
3 Replies
NeilClemmons
Regular Contributor III
Take a look at the IUniqueValueRenderer interface.
0 Kudos
GregRieck
Occasional Contributor III
Take a look at the IUniqueValueRenderer interface.



EDIT: I finally found an example. I think I can make it work with this old VB6 example

Hi Neil,

Thank you for your suggestion. Do you know of any sample code for doing this? I'm looking at using AddReferenceValue but I'm not clear on the second parameter. I'd like to pass in the name of the new value and use a random color from the current groups color ramp. Several of the properties require a string as part of the parameter. How do I determine the "refValue" to pass into the AddReferenceValue parameter? The help on this is confusing, it seems that Symbol points to ReferenceValue and ReferenceValue points to Symbol.

IUniqueValueRenderer

[C#] public void AddReferenceValue (     string Value,     string refValue );

[C#] public string get_ReferenceValue (     string Value );
0 Kudos
naimahossain1
New Contributor
Hi Grieck,
Could you find your solution? How to pass AddReferenceValue method's parameters?
0 Kudos