Layers
The RadSyntaxEditor control renders its elements on different layers based on the types of tags that are used. It does so with the help of a UILayersBuilder class. The default builder renders the following stack of layers:
- TextHighlightUILayer
- TextBorderUILayer
- TextUnderlineUILayer
- TextUILayer
- TextToolTipUILayer
- SelectionUILayer
- FoldingUILayer
These layers are responsible for drawing different elements on the canvas of the RadSyntaxEditor control. For example, the FoldingUILayer generates a FoldedRegionButton with a tooltip, containing the folded text.
Custom Layer and UILayersBuilder
We will now create a custom layer which will be responsible for highlighting any keywords when they are hovered with the mouse. For the purpose, we need to override the GetLinePartUIElement method and return a FrameworkElement to be drawn on the layer - a semi-transparent rectangle in this case.