CustomClassificationTagger foregroud color not changing

SyntaxEditor for WPF Forum

Posted 12 years ago by Nassim Farhat
Version: 11.2.0551

I'm having issues changing the text foreground color in my custom CustomClassificationTagger class i created. I used it the same way as you guys did in your sample, but instead, in the constructor I used another override of the HighlightingStyle method, as such:
 static CustomClassificationTagger()
            // Register the classification type for a warning that will render the squiggle in red
            AmbientHighlightingStyleRegistry.Instance.Register(ClassificationTypes.SyntaxError, new HighlightingStyle(Brushes.White, Brushes.LightBlue, true, false, HighlightingStyleLineStyle.Dot));
Now for some reason, all other options are set correctly except the foreground color of tags. I tried it with your demo and it works fine, but for some reason, even if i specify a Brushes.White or Brushes whatever color it keeps the black color only?

Do you have an idea of why such a scenario occurs?

I was also wondering what the "ClassificationTypes.SyntaxError" meant, I tried changing this argument for "ClassificationTypes.Identifier" and the formatting did not work?


Comments (1)

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

Each IClassificationType is a logical object that describes the kind of text it is tagged to. When you register an IClassificationType with an IHighlightingStyle in the style registry, it tells the syntax highlighter to render the style when it sees a range marked with the IClassificationType.

If you are making custom tagged ranges, you shouldn't be changing the style registered for pre-defined classification types. Instead, like in our AdornmentsIntraTextNotes sample in the IntraTextNoteTag.cs code, you should make your own ClassificationType instance and use that.

See if that helps at all.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.