Preferable way to switch language syntax part SyntaxEditor

SyntaxEditor for WPF Forum

Posted 14 years ago by Bernard Schoch - Senior Software Engineer, Genesis Financial Technologies
Avatar
I have one editor user window with the WPF Syntax editor in it with one language definition. I will need later the be able to switch the language on the fly when the user selects one of our flavor of languages. So what's the best way to do this?

Setup a different user control with each language flavor and flip the controls in and out.
Dynamically reset the language part of one syntax editor if possible?
Other?

Thanks,
Bernie

Comments (3)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bernie,

Just swap in the new language in the editor.Document.Language property. You can put a new language in there at any time.


Actipro Software Support

Posted 13 years ago by Matt Yaeger
Avatar
I have a related question. Is it possible not use any language after having set a language? I get an exception with the code 'Document.Language = null'. My use case is I want to toggle the same SE between using a language and using no language.

Thanks.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matt,

You should use SyntaxLanguage.PlainText in that case, which is a bare bones language with no lexer.


Actipro Software Support

The latest build of this product (v24.1.1) 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.