Text Element is unremovable on layout when adding from SDK.

04-29-2021 02:06 PM
Occasional Contributor

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);

  This is where the element originally is


In the next image I have added a mapframe and moved the text element.



This is what happens when I then export the layout.



Next I completely removed the text element from the layout using the TOC and this is what happened.


I believe this is a bug. Any insights or solutions  on this would be appreciated, thanks.

0 Kudos
0 Replies