任何人都知道我可以嵌入 WPF 窗口或 Windows 窗体的代码编辑器吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/394751/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:54:34  来源:igfitidea点击:

Anyone know a code editor I can embed in a WPF window or Windows forms?

wpf

提问by Malcolm

I want create my own IDE but I want a code editor that would syntax highlighting.

我想创建自己的 IDE,但我想要一个可以语法高亮显示的代码编辑器。

I want to embed it as a control into a WPF window.

我想将它作为控件嵌入到 WPF 窗口中。

Malcolm

马尔科姆

回答by Kris Erickson

The Sharp Develop IDEhas a great code editor that can be used in your programs relatively easily (it does require a little bit of work to figure out how it works, and it doesn't have "plug and play" documentation). If you look at the sourcefor Kaxamlyou can see how to embed it in WPF.

夏普开发的IDE具有可以在你的程序中使用相对容易大的代码编辑器(它确实需要工作的一点点要弄清楚它是如何工作的,它不具有“即插即用”的文件)。如果您查看Kaxaml源代码,您会看到如何将其嵌入 WPF。

回答by Andrey Shchekin

If you do not mind having no documentation whatsoever, AvalonEditis a good choice. I am currently using for a project, and it is a great tool. I have not encountered a single bug even in complex scenarios.

如果您不介意没有任何文档,AvalonEdit是一个不错的选择。我目前正在用于一个项目,它是一个很棒的工具。即使在复杂的场景中,我也没有遇到过一个错误。

You can find its source at svn://svnmirror.sharpdevelop.net/sharpdevelop/trunk/SharpDevelop/src/Libraries/AvalonEdit.

你可以在 svn://svnmirror.sharpdevelop.net/sharpdevelop/trunk/SharpDevelop/src/Libraries/AvalonEdit 找到它的来源。

回答by Dennis

Another option is Scintilla.NET (UPDATEDhttps://github.com/jacobslusser/ScintillaNET).

另一种选择是 Scintilla.NET(已更新https://github.com/jacobslusser/ScintillaNET)。

It is a .NET 2.0 wrapper around the Scintilla Native Control. We have successfully used to display/edit HLSL, XML, Text, and other internal scripting languages. It is easy to write a language description file for your own language if needed.

它是围绕 Scintilla Native Control 的 .NET 2.0 包装器。我们已经成功地用于显示/编辑 HLSL、XML、Text 和其他内部脚本语言。如果需要,很容易为您自己的语言编写语言描述文件。

I'm currently hosting the WinForms control in our WPF applications. The only difficulty was getting a WPF context menu to activate when clicking within the control; solved it by listening for a MouseRightButtonDown event on the WinFormsHost and then setting the ContextMenu visible (ContextMenu.IsOpen = true) :/

我目前在我们的 WPF 应用程序中托管 WinForms 控件。唯一的困难是在控件内单击时激活 WPF 上下文菜单;通过在 WinFormsHost 上侦听 MouseRightButtonDown 事件然后设置 ContextMenu 可见(ContextMenu.IsOpen = true)来解决它:/

I have been in contact with Actipro Software re: SyntaxEditor and the WPF version is being actively developed and will available soon. For the time-being we will continue to use Scintilla.NET

我一直在联系 Actipro Software re:SyntaxEditor,WPF 版本正在积极开发中,即将推出。目前我们将继续使用 Scintilla.NET

回答by Aurelien Ribon

Another possibility for WPF:

WPF的另一种可能性:

http://syntaxhighlightbox.codeplex.com/

http://syntaxhighlightbox.codeplex.com/

回答by Frans Bouma

SyntaxEditor from Actipro software (http://www.actiprosoftware.com). It's not going to get easier than that one.

来自 Actipro 软件 ( http://www.actiprosoftware.com) 的SyntaxEditor 。它不会变得比那更容易。

回答by Frans Bouma

Actipro SyntaxEditor for WPF's first public beta is now live (http://www.actiprosoftware.com/Products/DotNet/WPF/SyntaxEditor/Default.aspx). It has a very feature-rich base framework that we've put months of development time into based on our years of experience in this area. More features will be added soon but in the meantime check out the 40+ samples we offer. Works in XBAPs too!

WPF 的第一个公开测试版的 Actipro SyntaxEditor 现已上线 ( http://www.actiprosoftware.com/Products/DotNet/WPF/SyntaxEditor/Default.aspx)。它有一个功能非常丰富的基础框架,根据我们在该领域多年的经验,我们投入了数月的开发时间。更多功能将很快添加,但同时请查看我们提供的 40 多个样品。也适用于 XBAP!

回答by boreas

I know two available: qwhale editor

我知道两个可用:qwhale 编辑器

and sync fusion

同步融合

both are .net controls.

两者都是 .net 控件。

回答by boreas

Maybe you're interested in AqiStar.TextBox (http://aqistar-textbox.software.informer.com).

也许您对 AqiStar.TextBox ( http://aqistar-textbox.software.informer.com)感兴趣。

It's a syntax highlighting text editor control targeting WPF, fast and easy to use but not free.

这是一个针对 WPF 的语法高亮文本编辑器控件,快速且易于使用但不是免费的。