Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight XML editor / syntax highlighting

I am looking for a Silverlight text editor control that provides XML syntax highlighting. I found a few answers in Winforms or WPF, like here on Stackoverflow, but I didn't manage to convert them to Silverlight. The fact that Silverlight is missing System.Drawing is probably a big problem.

The only text editor I found for Silverlight is RichTextEdit on Codeplex, but I don't think it is a suitable base for real-time syntax highlighting.

Has anyone heard of such a control, or can provide hints on how to build one? Many thanks,

Romain

like image 753
Romain Avatar asked Jan 04 '09 23:01

Romain


3 Answers

I finally found that control I was looking for! SL2TextBoxWsSynParser

EDIT: This control does not seem to be updated anymore, but a new syntax-highlighting control has surfaced:

It is available here, and used on the CoderProof website.

like image 105
Romain Avatar answered Sep 27 '22 22:09

Romain


Actipro Software has a syntax highlighter component for Winforms, WPF, and Silverlight:

http://www.actiprosoftware.com/

like image 27
chadbr Avatar answered Sep 27 '22 20:09

chadbr


I thought this was an interesting question, but you've had no answer.

I don't know of an existing control.

I've built a control to edit XHTML, but it too uses System.Drawing rather than WPF (and therefore isn't for Silverlight).

WPF is probably at least as capable as System.Drawing, but I don't know it.

Hints on how I built it:

  • Define a DOM (a vanilla System.Xml.XmlDocument might suit you)
  • Parse a document to instantiate a DOM
  • Define a user control (with scroll bars)
  • Pass the DOM instance to the user control
  • In the control's 'paint' method, paint the visible fraction of the DOM
  • Implement support for mouse and key presses

If you really want hints on how to build one, ask something more specific.

like image 26
ChrisW Avatar answered Sep 27 '22 22:09

ChrisW