Graphic graphic = _featureLayer.Graphics.Where(g => (int)g.Attributes[OBJECTID] == ObjectId).FirstOrDefault(); graphic[NAME] = newValue; _feaureLayer.Save();
Solved! Go to Solution.
When I create a FeatureLayer object in code like shown in the thread on adding records and call initialize on the FeatureLayer, when the Initialized is returned the Graphics collection is empty even though there are objects in my table.
The graphics collection is populated after the initialization phase during the draw of the map. So it's normal that the graphics collection is empty when the Initialized event is fired.
You can subscribe to Updated event instead.
Also, did you insert your feature layer in a Map? If you didn't, you have to call 'Update' by yourself else the feature layer won't ever be updated.
I added the Update handlers and when the FeatureLayer is added to the map via code it fails on Update with a Error Code 400: Unable to complete operation "Unable to perform query." This occurs whenever I zoom the map. Again this will work when the FeatureLayer is added in xaml