WPF support for "dynamic" languages

SyntaxEditor for WPF Forum

Posted 9 years ago by Erel Uziel
Version: 14.2.0611

I'm a long time user of the WinForms SyntaxEditor control.

I now want to move to the WPF control. Is it possible in the WPF control to modify the language during runtime (for example adding new types that should be colored differently).


Another question, will it be possible to implement conditional compilation? For example:


grey text here


normal text here


Comments (3)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Erel,

Do you mean that you'd like type names to be colored differently from normal identifiers?  If so, while we have done some looking into this, we haven't gotten it working in a performant way since you effectively need to run the resolver on every identifier in the document.

We don't currently have anything built in for conditional compilation.  In the WPF version, you could possibly achieve something like this though by using classification taggers and tagging each "false" range's text using style with a gray foreground.  I'll log the suggestion for built-in support of this.

Actipro Software Support

Posted 9 years ago by Erel Uziel

With the WinForms control I'm using this code to update the types when a background thread detects a new type:

IsUpdating = true;
LexicalPatternGroup lpg = ((DynamicLexicalState)LexicalStates[0]).LexicalPatternGroups["TypeWordToken"];
foreach (string s in types)
lpg.Add(new LexicalPattern(s));
IsUpdating = false;


Can we do similar thing with the new control?

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Yes, you can but there's a different syntax than IsUpdating.  Please see the "SyntaxEditor / Text/Parsing Framework / Lexing / Basic Concepts" topic in the documentation and look at the "Changing Mergable Lexers" section in that.

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.