//-------------------------------------------

//

// syntax highlight example

//

//-------------------------------------------

// validate and apply selected style

void ValidateAndApplyStyle()

{

var style = _cmbStyle.Text;

int start = style.IndexOf('<');

int end = style.IndexOf('>');

if (end > -1 && end > start)

{

Editor.SelectionRanges.ApplyStyle(style.Substring(start + 1, end - start - 1));

}

}

// get the node that is currently selected

XmlNode GetSelectedNode()

{

var selRange = Editor.Selection.Range;

if (selRange != null)

{

var startNode = selRange.StartPosition.CurrentScope;

var endNode = selRange.EndPosition.CurrentScope;

return object.Equals(startNode, endNode)

? startNode

: null;

}

return null;

}