xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid x:Name="LayoutRoot" Background="White"> <esri:Map x:Name="MyMap"> <esri:ArcGISTiledMapServiceLayer ID="MyLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" /> <esri:FeatureLayer ID="Test" DisableClientCaching="True" OutFields="*" AutoSave="False" Where="fcode != 11001" Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0"> <esri:FeatureLayer.MapTip> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <ItemsControl ItemsSource="{Binding Keys}" Grid.Column="0" /> <ItemsControl ItemsSource="{Binding Values}" Grid.Column="1" /> </Grid> </esri:FeatureLayer.MapTip> </esri:FeatureLayer> </esri:Map> <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center"> <Button Content="Update" Click="Button_Click"/> <esri:EditorWidget Map="{Binding ElementName=MyMap}" /> </StackPanel> </Grid>
private void Button_Click(object sender, RoutedEventArgs e) { var l = MyMap.Layers["Test"] as FeatureLayer; l.Update(); }
FeatureLayer tagsLyr = currentApps.MapControl.Layers["Tags Feature Layer"] as FeatureLayer; tagsLyr.UpdateCompleted -= tagsLyr_UpdateCompleted; tagsLyr.UpdateCompleted += new EventHandler(tagsLyr_UpdateCompleted); tagsLyr.EndSaveEdits += new EventHandler<EndEditEventArgs>(tagsLyr_EndSaveEdits); //get graphics in the current extent of the tags feature layer GraphicCollection gl = tagsLyr.Graphics; //get graphisc in the list which have tag_id that are in the parameter var x = from t1 in gl join t2 in listOfTagIDs on t1.Attributes["tag_id"] equals t2.ToString() select t1; List<Graphic> graphicsToBeModified = x.ToList(); foreach (Graphic item in graphicsToBeModified) { item.Attributes["isactive"] = "f"; } if (tagsLyr.HasEdits) { tagsLyr.SaveEdits(); tagsLyr.Where = "isactive = 't'"; tagsLyr.Update(); } tagsQryGrLayer.ClearGraphics();
void tagsLyr_UpdateCompleted(object sender, EventArgs e) { FeatureLayer fl = sender as FeatureLayer; GraphicCollection gl2 = fl.Graphics; IList<Graphic> src = fl.GraphicsSource as IList<Graphic>; fl.Refresh(); } void tagsLyr_EndSaveEdits(object sender, EndEditEventArgs e) { ArcGISDynamicMapServiceLayer srvc = McgmMap.Layers["Ghatkopar Map Service"] as ArcGISDynamicMapServiceLayer; srvc.Refresh(); }