Parameters
- features
- A set of features to move.
- dx
- Units along the x-axis to move the geometry.
- dy
- Units along the y-axis to move the geometry.
//Get all of the selected ObjectIDs from the layer. var firstLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(); var selectionfromMap = firstLayer.GetSelection(); // set up a dictionary to store the layer and the object IDs of the selected features var selectionDictionary = new Dictionary<MapMember, List<long>>(); selectionDictionary.Add(firstLayer as MapMember, selectionfromMap.GetObjectIDs().ToList()); var moveFeature = new EditOperation() { Name = "Move features" }; //at 2.x - moveFeature.Move(selectionDictionary, 10, 10); //specify your units along axis to move the geometry moveFeature.Move(SelectionSet.FromDictionary(selectionDictionary), 10, 10); //specify your units along axis to move the geometry if (!moveFeature.IsEmpty) { var result = moveFeature.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not }
Target Platforms: Windows 11, Windows 10