I need to refine when some code is run in response to an attribute change value in a FeatureDataForm. I am trying to capture a changed attribute value in a form right click event procedure. Apparently the layer edits must first be saved to get the new value. However the feature layer SaveEdits() method seems to have no effect when used in the right click event procedure. The section of code for this is shown below (gChange is global).
private void fdform_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
if (fdform.HasEdits)
{
object src = e.OriginalSource; //returns the border for the form, can also get position relative to particular UI elements
FeatureLayer featureLayer = gChange.Layer as FeatureLayer;
featureLayer.SaveEdits(); //seems to have no effect
string val1 = editFeat.Attributes["Common_Name"].ToString(); // "unknown"
string val2 = String.Copy("unknown"); //to avoid being saved in the same memory location as var1
bool blnIsEqual = val1.Equals(val2, StringComparison.Ordinal);
...
I would ideally like to save edits temporarily and undo them to allow the user to save a feature when done editing of that feature.
(Although using the Graphic.AttributeValueChanged procedure is effective in some ways, the timing is after the user presses the SaveEdits button on the EditorWidget.)