await QueuedTask.Run(() => { //Don't use 'Shape'....Shape is the bounding box of the annotation text. This is NOT what you want... // //var insp = new Inspector(); //insp.Load(annoLayer, oid); //var shape = insp["SHAPE"] as Polygon; //...wrong shape... //Instead, we must use the AnnotationProperties //annoLayer is ~your~ Annotation layer //at 2.x - var insp = new Inspector(true); var insp = new Inspector(); insp.Load(annoLayer, oid); AnnotationProperties annoProperties = insp.GetAnnotationProperties(); var shape = annoProperties.Shape; if (shape.GeometryType != GeometryType.GeometryBag) { var newGeometry = GeometryEngine.Instance.Move(shape, 10, 10); annoProperties.Shape = newGeometry; insp.SetAnnotationProperties(annoProperties); EditOperation op = new EditOperation(); op.Name = "Change annotation angle"; op.Modify(insp); op.Execute(); } });
Target Platforms: Windows 11, Windows 10, Windows 8.1