I am adding a text element via sdk on the LayoutAdded event. If I move that text element on my layout it shows twice when I export the layout. It shows both where I originally set the element programmatically and it shows in the location I moved it to. I can't get rid of the original element graphic no matter what I do. If I remove the text element it still shows when I export the layout. This is the code I use below, the "LayoutAddedEvent.Subscribe" is located in the initialize function of an add-in.
LayoutAddedEvent.Subscribe(OnLayoutAdded, true);
private async void OnLayoutAdded(LayoutAddedEventArgs obj)
{
var lyt = obj.Layout;
String Disclaimer2 = "This is a disclaimer.";
await QueuedTask.Run(() =>
{
Coordinate2D titleTxt_ll = new Coordinate2D(0, 0);
CIMTextSymbol arial36bold = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8, "Arial", "Bold");
GraphicElement titleTxtElm = LayoutElementFactory.Instance.CreatePointTextGraphicElement(obj.Layout, titleTxt_ll, Disclaimer2, arial36bold);
titleTxtElm.SetName("Disclaimer");
//titleTxtElm.SetLocked(true);
});
}
This is where the element originally is
![JamalWest2_0-1619729788745.png JamalWest2_0-1619729788745.png](https://community.esri.com/t5/image/serverpage/image-id/12192i13E5D5C71918EDA1/image-size/medium?v=v2&px=400)
In the next image I have added a mapframe and moved the text element.
![JamalWest2_2-1619729969350.png JamalWest2_2-1619729969350.png](https://community.esri.com/t5/image/serverpage/image-id/12194i892A779AC065E998/image-size/medium?v=v2&px=400)
This is what happens when I then export the layout.
![JamalWest2_3-1619730085863.png JamalWest2_3-1619730085863.png](https://community.esri.com/t5/image/serverpage/image-id/12195i9FFD7653BCDD439C/image-size/medium?v=v2&px=400)
Next I completely removed the text element from the layout using the TOC and this is what happened.
![JamalWest2_4-1619730216675.png JamalWest2_4-1619730216675.png](https://community.esri.com/t5/image/serverpage/image-id/12197i8394821F894BB64F/image-size/medium?v=v2&px=400)
.
I believe this is a bug. Any insights or solutions on this would be appreciated, thanks.