Text Element is unremovable on layout when adding from SDK.

90
0
04-29-2021 02:06 PM
JamalWest2
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);
                titleTxtElm.SetName("Disclaimer");
                //titleTxtElm.SetLocked(true);
                
            });
        }

  This is where the element originally is

JamalWest2_0-1619729788745.png

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

JamalWest2_2-1619729969350.png

 

This is what happens when I then export the layout.

JamalWest2_3-1619730085863.png

 

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

JamalWest2_4-1619730216675.png

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

0 Kudos
0 Replies