ArcGIS Pro 2.9 API Reference Guide
LoadFromTextGraphic Method
Example 

ArcGIS.Desktop.Editing Namespace > AnnotationProperties Class : LoadFromTextGraphic Method
the text graphic to load.
Loads the specified text graphic into the annotation properties.
Syntax
public void LoadFromTextGraphic( 
   CIMTextGraphic textGraphic
)
Public Sub LoadFromTextGraphic( _
   ByVal textGraphic As CIMTextGraphic _
) 

Parameters

textGraphic
the text graphic to load.
Example
await QueuedTask.Run(() =>
{

  var selection = annoLayer.GetSelection();
  if (selection.GetCount() == 0)
    return;

  // use the first selelcted feature 
  var insp = new Inspector(true);
  insp.Load(annoLayer, selection.GetObjectIDs().FirstOrDefault());

  // getAnnoProperties should return null if not an annotation feature
  AnnotationProperties annoProperties = insp.GetAnnotationProperties();
  // get the textGraphic
  CIMTextGraphic textGraphic = annoProperties.TextGraphic;

  // change text
  textGraphic.Text = "Hello world";

  // set x,y offset via the symbol
  var symbol = textGraphic.Symbol.Symbol;
  var textSymbol = symbol as CIMTextSymbol;
  textSymbol.OffsetX = 2;
  textSymbol.OffsetY = 3;

  textSymbol.HorizontalAlignment = HorizontalAlignment.Center;

  // load the updated textGraphic
  annoProperties.LoadFromTextGraphic(textGraphic);
  // assign the annotation properties back 
  insp.SetAnnotationProperties(annoProperties);

  EditOperation op = new EditOperation();
  op.Name = "modify symbol";
  op.Modify(insp);
  bool result = op.Execute();
});
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

AnnotationProperties Class
AnnotationProperties Members