Change Annotation Text attribute while using Annotation Tool

228
1
Jump to solution
02-12-2024 08:46 AM
DaveWilcox
New Contributor III

Hi All

I am working to implement an annotation tool that includes a pulldown menu of standard text items. While using the tool, launched from the create feature pane, the user can select a text item from the menu and it would update the text for the tool so that the current item would be created using that text. I can make it work on completion of the sketch, but I need to update it before that so the user can make sure the annotation fits in the desired location.

I am updating the tool's current template, but that change is not reflected in the pane or on the tool itself.

This code is triggered by the propertychanged event on the embedded tool options pane.

        private void UpdateStampToolText(string stampToolText)
        {
            if (CurrentTemplate == null || stampToolText == null) return;

            QueuedTask.Run(() =>
            {
                this.CurrentTemplate.Inspector["TextString"] = stampToolText;

            });
        }

 

Am I missing something?

Thanks!

- Dave 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DaveWilcox
New Contributor III

I think I've answered my own question. Using the annotation properties object allowed me to adjust the current annotation text.

        private void UpdateStampToolText(string stampToolText)
        {
            if (CurrentTemplate == null || stampToolText == null) return;

            QueuedTask.Run(() =>
            {
                Inspector inspector = this.CurrentTemplate.Inspector;
                AnnotationProperties annoProperties = inspector.GetAnnotationProperties();
                annoProperties.TextString = stampToolText;
                inspector.SetAnnotationProperties(annoProperties);
            });
        }

View solution in original post

0 Kudos
1 Reply
DaveWilcox
New Contributor III

I think I've answered my own question. Using the annotation properties object allowed me to adjust the current annotation text.

        private void UpdateStampToolText(string stampToolText)
        {
            if (CurrentTemplate == null || stampToolText == null) return;

            QueuedTask.Run(() =>
            {
                Inspector inspector = this.CurrentTemplate.Inspector;
                AnnotationProperties annoProperties = inspector.GetAnnotationProperties();
                annoProperties.TextString = stampToolText;
                inspector.SetAnnotationProperties(annoProperties);
            });
        }
0 Kudos