Hi,
Can i use the example provided by ESRI for extend and trim to work on a feature?
example is given in interactive sdk :-http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#TrimExtend
Regards,
Sameer
Hi,
Can i use the example provided by ESRI for extend and trim to work on a feature?
example is given in interactive sdk :-http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#TrimExtend
Regards,
Sameer

Sure you can. You can update graphic.Geometry to the result you get from GeometryService_TrimExtendCompleted event.
However, do you mean to do Cut? Editor.Cut is already available. You can try out this sample: http://help.arcgis.com/en/webapi/sil...tToolsAutoSave. Select a feature and activate Cut command.
Jennifer Nery
Software Developer
ArcGIS API for SL/WPF/WP7
Hi,
Thanks for replying.
I assigned the obtained graphics but i am getting error - 400 unable to apply edits. I am using SaveEditFailed event to check if it is getting updated. I guess there is issue with the way i am building graphic, i guess there should be attribute which should be associated with the graphic which is causing issue in saving the returned geometry
below is my code : -
void GeometryService_TrimExtendCompleted(object sender, GraphicsEventArgs e)
{
//getFeatLayer.ClearGraphics();
Graphic resultGraphic = null;
foreach (Graphic g in e.Results)
{
g.Symbol = this.Resources["DefaultLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
resultGraphic = g;
//getFeatLayer.Graphics.Add(g);
GraphicsLayer TrimGraphicLyr = this.graphicsLayer as GraphicsLayer;
//TrimGraphicLyr.ClearGraphics();
//TrimGraphicLyr.Graphics.Add(g);
getFeatLayer.Graphics.Add(g);
}
foreach (Graphic g1 in getFeatLayer.SelectedGraphics)
{
//resultGraphic.Attributes.Add(g1.Attributes.ToArray());
foreach (var f in getFeatLayer.LayerInfo.Fields)
{
resultGraphic.Attributes[f.Name] = f.Nullable ? null : "testing";
}
getFeatLayer.Graphics.Remove(g1);
}
//Editor editor = LayoutRoot.Resources["MyEditor"] as Editor;
foreach (GraphicsLayer graphicsLayer in featureEditor.GraphicsLayers)
{
if (graphicsLayer is FeatureLayer)
{
FeatureLayer featureLayer = graphicsLayer as FeatureLayer;
if (featureLayer.HasEdits)
featureLayer.Update();
featureLayer.SaveEditsFailed+=new EventHandler<TaskFailedEventArgs>(featureLayer_SaveEditsFailed);
featureLayer.SaveEdits();
featureLayer.Refresh();
}
}
MyDrawObject.IsEnabled = true;
}
protected void featureLayer_SaveEditsFailed(object sender, EventArgs e)
{
}
Last edited by hrithikesh3485; 04-26-2012 at 10:42 PM. Reason: correction

TrimExtendAsync() has an overload that takes user token, you can use that instead to pass the original graphics.
In the completed event you can do
var originalGraphics = e.UserToken as Graphic[];
and update each geometry.
Graphics.Add() adds a new graphic which is not what you want to do. You need to update the existing graphic. Run Fiddler to see the save request (../applyEdits), this should show update instead of add.
Jennifer Nery
Software Developer
ArcGIS API for SL/WPF/WP7
Hi jennifer,
Thanks for the suggestion,
I am new to silverlight and did not exactly understand how to use that UserToken.
I am using c# and i checked GeometryService_TrimExtendCompleted() and it did not had any e.UserToken which i could typecast to Graphic. I am using the same code which has been pasted above can you please paste some sample which will help me do this ?
Regards,
Sameer
Bookmarks