Select to view content in your preferred language

FeatureDataForm refresh after coded value domain change

2160
4
11-11-2011 09:57 AM
MikeDuppong
Emerging Contributor
I'm programmatically modifying the values of a coded value domain, and after doing so, can't seem to get the FeatureDataForm to refresh so the combobox displays the new set of values.  Is there a trick?
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
Thank you for reporting this. I was able to reproduce with this sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataForm. I added a Button with this code in the click event:
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var g = MyFeatureDataForm.GraphicSource;
            g.Attributes["req_type"] = "Graffiti Complaint �?? Private Property"; //updates fine
            g.Attributes["status"] = (Int16)1; // fails to update
        }


You can download source code for FeatureDataForm http://esrisilverlight.codeplex.com/and make changes there or use your own user control.

I added the following TextBlock with DataContext pointing to FeatureDataForm.GraphicSource and the Binding statement here allows it to be updated when the attribute value is changed.
<TextBlock x:Name="MyTB" Text="{Binding Attributes[status]}"/>
0 Kudos
MikeDuppong
Emerging Contributor
Thanks, Jennifer, but I'm reporting a different problem.  I am not modifying the attributes of a feature, I'm modifying a column's coded value domain.  For example,


FeatureLayer ptFeatureLayer = map1.Layers["pointFeatureLayer"] as FeatureLayer;
foreach (Field field in ptFeatureLayer.LayerInfo.Fields)
{
 if (field.Name.ToLower() == "habitat")
 {
  CodedValueDomain ptCVD = field.Domain as CodedValueDomain;
  ptCVD.CodedValues.Clear();
  ptCVD.CodedValues.Add("test1", "test1");
  ptCVD.CodedValues.Add("test2", "test2");
  // how to update the featuredataform combobox for the new CVD values?   
  break;
 }
}
0 Kudos
ChristopherHill
Deactivated User
The FeatureDataForm only works off the Domains that come from the FeatureLayer.LayerInfo. You have to add the new CodedValueDomain to your service then republish the service with the additional CodedValueDomains.
0 Kudos
MikeDuppong
Emerging Contributor
Thanks for the reply, Chris.

Unfortunately, republishing the service is impractical for our application.

Investigating SOE's as a workaround.  If I have no luck there, I will have to abandon the Silverlight API, which would be a bummer.
0 Kudos