WPF语法高亮控件AvalonEdit
来源:互联网 发布:linux不保存退出vi 编辑:程序博客网 时间:2024/06/07 08:06
AvalonEdit is a WPF-based extensible text editor.
AvalonEdit是基于WPF的可扩展的文本编辑器。
While the WPF RichTextBox is quite powerful, you quickly run into its limits when trying to use it as a code editor: it's hard to write efficient syntax highlighting for it, and you cannot really implement features like code folding with the standard RichTextBox.
虽然WPF的RichTextBox功能很强,使用它当代码编辑器时运行迅速。但用它写有效的语法高亮文本还是比较困难,并且不能真正实现像代码折叠之类的特性。
The problem is: the RichTextBox edits a rich document. In contrast, AvalonEdit simply edits text.
问题有:RichTextBox是一个富文档编辑器,与此不同的是,AvalonEdit是一个简单文本编辑器。
However, AvalonEdit offers lots of possibilities on how the text document is displayed - so it is much more suitable for a code editor where things like the text color are not controlled by the user, but instead depend on the text (syntax highlighting).
然而,AvalonEdit为如何显示文档提供了多种可能性,比如文本颜色不是由用户控制,而是依赖于文本(语法高亮)的情况,所以它作为代码编辑器是非常合适的。
AvalonEdit was written for the SharpDevelop IDE. It replaces our old Windows Forms-based text editor (ICSharpCode.TextEditor).
AvalonEdit 是为SharpDevelop IDE而开发的编辑器,它代替了传统windows 面向表单文本的编辑器(ICSharpCode.TextEditor)。
The main class of the editor is ICSharpCode.AvalonEdit.TextEditor. You can use it similar to a normal WPF TextBox:
编辑器的主要类是ICSharpCode.AvalonEdit.TextEditor,可以用它来写一个简单的WPF文本框控件。
<avalonEdit:TextEditor xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit" Name="textEditor" SyntaxHighlighting="C#" FontFamily="Consolas" FontSize="10pt"/>
There are two versions of AvalonEdit - the normal one requires .NET Framework 4.0 or higher; but we also offer a modified version for .NET 3.5 SP1. For compiling AvalonEdit, you will need a C# 4.0 compiler (SharpDevelop 4.x or Visual Studio 2010).
AvalonEdit有两个版本,普通版需要.Net Framework 4.0或更高版本的支持,另外也提供了基于.Net 3.5 SP1的改良版。编译AvalonEdit时,需要C#4.0的编辑器。(SharpDevelop 4.x 或 Visual Studio 2010).
private static FoldingManager foldingManager = null; private static XmlFoldingStrategy foldingStrategy = new XmlFoldingStrategy(); //快速搜索 txtTemplateContent.TextArea.DefaultInputHandler.NestedInputHandlers.Add(new SearchInputHandler(txtTemplateContent.TextArea)); //显示行号 txtTemplateContent.ShowLineNumbers = true; //默认语法高亮规则 txtTemplateContent.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(".xml"); //折叠 foldingManager = FoldingManager.Install(txtTemplateContent.TextArea); txtTemplateContent.Text = DispContentValue; foldingStrategy.UpdateFoldings(foldingManager, txtTemplateContent.Document);
应用语法高亮读取xslt文档效果如下:
- WPF语法高亮控件AvalonEdit
- 语法高亮控件
- RichEdit 控件:语法高亮显示
- 语法高亮显示控件ICSharpCode.TextEditor
- 爱上语法高亮控件ICSharpCode.TextEditor ~o~
- 用c#实现的语法高亮控件
- 用c#实现的语法高亮控件
- WPF如何更改系统控件的默认高亮颜色 (Highlight brush)
- 语法高亮
- 测试语法高亮
- vim语法高亮
- vim语法高亮
- 测试语法高亮
- 测试语法高亮
- 语法高亮
- vi 语法高亮
- 试试语法高亮。。。
- 自动语法高亮
- 软交所助力国家级软件评测中心
- 单文件上传
- head first series 学习记录(Python)
- java枚举类型enum的使用
- jquery-easyui 后台加载数据的问题
- WPF语法高亮控件AvalonEdit
- 当一种信奉根深柢固的时分,慢慢地表面也会发生改变
- 代理模式
- tomcat启动的时候,没加载xml配置文件
- float 与double 的区别
- ios中frame与bounds区别
- C#遍历指定文件夹中的所有文件
- Classifier4J的中文支持
- Android通过XML来定义Menu