SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

TextEditorControl and Syntax Highlighting (XML)

Last post 03-18-2008 3:09 PM by madmagi. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-17-2008 5:16 PM

    TextEditorControl and Syntax Highlighting (XML)

    Hello,

     I am trying to use the TextEditorControl in an internal project.  The main use is to display an XML file and allow the user to modify the file (mock responses). 

    I seem to have no issue loading a string into the TEC so I can load my XML file in just fine.  But i do not get any syntax highlighting at all.

    What are the steps i need to do to enable this?

    Thanks in advance.

    Lester

    Filed under:
  • 03-17-2008 10:02 PM In reply to

    Re: TextEditorControl and Syntax Highlighting (XML)

    Either load the file directly using the text editor's LoadFile method.

          textEditor.LoadFile(@"d:\temp\test.xml");         

    Or if you are using a string then use the HighlightingManager to get the correct syntax highlighting. You can either use the FindHighlighterForFile method 

        textEditor.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighterForFile(".xml");

    Or the FindHighlighter method

        textEditor.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("XML"); 

    The highlighting manager is in the ICSharpCode.TextEditor.Document namespace.

  • 03-18-2008 3:09 PM In reply to

    Re: TextEditorControl and Syntax Highlighting (XML)

    Wonderful!  That worked perfectly.  Thanks!

     

    Lester

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.