FeatureLayer l = sender as FeatureLayer;
foreach (var f in l.LayerInfo.Fields)
{
if (f.Domain is CodedValueDomain)
{
CodedValueDomain cvd = f.Domain as CodedValueDomain;
foreach (var item in cvd.CodedValues)
{
//TODO: check for item.Key and item.Value
}
}
}
When you visit the FeatureLayer URL from your web browser, do you see coded values similar to this? http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer...
If it is empty there too, then maybe the issue is with your service. I think these are the steps you do for creating a coded value domain: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Creating_a_new_coded_value_domain/001s...