我将 ICSharpCode AvalonEdit 源代码编辑 WPF 控件托管到我的 Windows 窗体 C# 应用程序中。我知道以下代码加载了语法高亮定义:
ICSharpCode.AvalonEdit.TextEditor MyEditor = new ICSharpCode.AvalonEdit.TextEditor();
MyEditor.ShowLineNumbers = true;
Stream xshd_stream = File.OpenRead("C:\\Syntax Highlighting\\php.xsdh");
XmlTextReader xshd_reader = new XmlTextReader(xshd_stream);
// Apply the new syntax highlighting definition.
MyEditor.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(
xshd_reader, ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance
);
xshd_reader.Close();
xshd_stream.Close();
但是,如果在我已经设置了语法高亮定义之后,我不想要任何语法高亮,我只想让它显示为纯文本呢?如何禁用 AvalonEdit 控件中的语法突出显示?