Hi, I was trying to add a new element into my featurelayer service programmatically, but when I save the editions, it seems that doesn't work because I can't see changes on the map neither the data.I was trying to use on my code behind an editor declared on the xaml, getting an instance of the feature layer from there, and then adding my new element with an Graphic instance that I create before, so, I use the add method of the feature layer and after that the saveEdit method, and finally the refresh methos to refresh my map.Can anybody help me, I would like to know what I'm doing wrong about that, I'm posting fragments of my code to show what I explained before.Thanks.*Fragment of the xaml declaring the editor
<Grid.Resources>
<esri:Editor x:Key="Editor"
Map="{Binding ElementName=Map}"
LayerIDs="Poligonos" GeometryServiceUrl="http://crbd02/ArcGIS/rest/services/Geometry/GeometryServer"
/>
</Grid.Resources>
*Fragment of the code declaring the Map and the feature layer
<!-- Map Control -->
<esri:Map x:Name="Map" Background="White" WrapAround="true" IsLogoVisible="False" Extent="-1442632.89843668,-274130.672780001,8713596.00123668,5756744.12838">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<ei:ChangePropertyAction TargetName="myMenuItems" PropertyName="Visibility">
<ei:ChangePropertyAction.Value>
<Visibility>Collapsed</Visibility>
</ei:ChangePropertyAction.Value>
</ei:ChangePropertyAction>
</i:EventTrigger>
</i:Interaction.Triggers>
<esri:FeatureLayer ID="Poligonos" Url="http://crbd02/ArcGIS/rest/services/DemosAPIs/Edicion_APIS/FeatureServer/0" AutoSave="False" x:Name="Poligonos"
Mode="OnDemand" ValidateEdits="True" DisableClientCaching="True"/>
</esri:Map>
*Fragment of the code adding the new element into the feature layer, the object gra have the graphic that I draw before and I want to add to the feature layer.
Graphic gra = null;
gra = VentanaDerroteroEnPanel.FinalizarDibujo();
PanelVentanaDerrotero.Visibility = System.Windows.Visibility.Collapsed;
Editor editor = LayoutRoot.Resources["Editor"] as Editor;
foreach (GraphicsLayer graphicsLayer in editor.GraphicsLayers)
{
if (graphicsLayer is FeatureLayer)
{
FeatureLayer featureLayer = graphicsLayer as FeatureLayer;
if (featureLayer.ID == "Poligonos")
{
featureLayer.Graphics.Add(gra);
featureLayer.SaveEdits();
featureLayer.Refresh();
}
}
}