45

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

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

Malcolm

Malcolm
  • 12,524
  • 28
  • 89
  • 125

3 Answers3

36

The Sharp Develop IDE has 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 source for Kaxaml you can see how to embed it in WPF.

Kris Erickson
  • 33,454
  • 26
  • 120
  • 175
27

If you do not mind having no documentation whatsoever, AvalonEdit is 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.

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

Andrey Shchekin
  • 21,101
  • 19
  • 94
  • 162
  • Andrey, where is the source code for AvalonEdit? I browsed sharpdevelop.net but didn't find any links to AE's source code – aku Jan 18 '09 at 11:35
  • You can find it at svn://svnmirror.sharpdevelop.net/sharpdevelop/trunk/SharpDevelop/src/Libraries/AvalonEdit. I am not sure if there is a http browser for sharpdevelop sources, but TortoiseSVN works just fine. – Andrey Shchekin Jan 18 '09 at 14:31
  • 4
    I found a great guide for AvalonEdit here: http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor – Drahcir Jan 26 '13 at 12:56
  • 3
    There's now full documentation on the publisher's website: http://avalonedit.net/documentation/ –  May 28 '16 at 22:36
10

Another option is Scintilla.NET (UPDATED 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.

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) :/

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

Dennis
  • 20,275
  • 4
  • 64
  • 80