Select to view content in your preferred language

FeatureDataForm commit disabled

512
1
03-23-2012 08:08 AM
JeffRogholt
Emerging Contributor
We have 2 controls on a page.  One comboxbox and one featuredataform.

The combobox contains user names and their id.  One of the attributes of the graphicsource is assignedto.  I added the SelectionChanged event to the combobox which modifies the attribute.  The correct id displays in the featuredataform but the commit button remains disabled; therefore, not allowing the user to save their changes.

Is there a way to enable the commit button allowing the user to save their changes?

We're using the Silverlight 2.4 API, Visual Studio 2010, and Silverlight 4.


Thanks,
Jeff
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
Is the FeatureLayer.AutoSave=False? By default AutoSave=True so any changes you make on the layer is committed on the server unless you specify AutoSave=False.

I've slightly modified this SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolkitFeatureDataForm. By setting AutoSave=False and adding the following ComboBox. Instead of relyling on FeatureLayer.MouseLeftButtonDown, I use ComboBox.SelectionChanged event to update FeatureDataForm.GraphicSource.

        <ComboBox VerticalAlignment="Top" HorizontalAlignment="Center" SelectionChanged="ComboBox_SelectionChanged"
                  ItemsSource="{Binding ElementName=MyMap, Path=Layers[PointLayer].Graphics}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Attributes[objectid]}"/>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>


       
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var graphic = (sender as ComboBox).SelectedItem as Graphic;
            var layer = MyFeatureDataForm.FeatureLayer;
            foreach (var g in layer.Graphics)
                if (g.Selected) g.UnSelect();
            graphic.Select();
            MyFeatureDataForm.GraphicSource = graphic;
            FeatureDataFormBorder.Visibility = Visibility.Visible;
        }
0 Kudos