How to clear my adornments???

SyntaxEditor for WPF Forum

Posted 12 years ago by Nassim Farhat
Version: 11.2.0551

I've been looking through your samples + the documentation but i've not found how to clear my adornments correctly. Let me place you into the context. I create IntraText adornments that i place all in one shot within specially designated tokens.

Now I succeeded to palce my intratext adornment controls succesfully.

to obtain the adornmentManager i created through the language service

RegisterService(new AdornmentManagerProvider<IntraTextDebugAdornmentManager>(typeof(IntraTextDebugAdornmentManager)));
This is how i get the adornmentManager:

AdornmentManagerProvider<IntraTextDebugAdornmentManager> adornmentProvider = ActiveEditor.Document.Language.GetService<AdornmentManagerProvider<IntraTextDebugAdornmentManager>>();
            IntraTextDebugAdornmentManager adornmentManager = (IntraTextDebugAdornmentManager)adornmentProvider.GetAdornmentManager(ActiveEditor.ActiveView);
But when i call
It goes to the OnClosed() event of my "IntraTextDebugAdornmentManager" where i perform the following code

        protected override void OnClosed()
            // Remove any remaining adornments
The result is that in the current editor's view, the adornements disappear, but the text formatting does not return to normal... what i mean is that all the formatted text spaces where my intratext controls where placed are still there... it s just that those spaces are now empty?!? I also noticed that if i scroll down the editor and back up, Low and Behold my adornment controls all come back on the screen where the spaces where empty!

When I call close How to i:
1- Get rid of all my adornments
2- Get my original text formatting back to how it was before i placed the intra text adornments. I tried calling
after the close() call, but nothing!


Comments (1)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Nassim,

Intra-text adornments are always driven by tags. So adornments will be re-created if your tags still exist. You need to remove the tags and that will in turn remove the adornments (you shouldn't need to call RemoveAllAdornments).

Like in the AdornmentsIntraTextNotes sample, we currently have an add button whose click handler calls tagger.Add(...) to add a tag. You could call Clear() instead and that will remove them all.

Actipro Software Support

The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.