8

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

4 Answers 4

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

An updated version can be found here: vladhorby.com/blog/post/2010/11/01/… . It now supports various languages (C#, VB.NET, XML, etc)
4

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

http://www.actiprosoftware.com/

Comments

1

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.

Comments

0

Hi & thanks for your answer!

Unfortunately, while WPF has drawing capabilities, Silverlight runs a very restricted set of the CLR. Painting the user control looks like quite a difficult task.

However it has been done before with this Rich text editor for Silverlight. I will see if I manage to use similar techniques to render the XML document.

One question though: is the user control fast enough to render the DOM on the fly, as the user makes changes?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.