SyntaxEditor - Bookmark Indicators

by Avatar Bill Henning (Actipro) - 2 comments
Thursday, March 7, 2013 at 1:40pm


One of the feature areas we're adding to WPF and Silverlight SyntaxEditor controls is the ability to create indicators, which are special "tagged" regions of text that optionally display a glyph in the indicator margin or highlight the text range with special styles.

Several built-in indicator types will come with SyntaxEditor, one of them being bookmarks.

Bookmark Indicators

Bookmarks are line-based indicators, meaning they associate themselves with a single line of text.  Even as the line gets edited, they remain associated with a single full line.  They move around with the same logic found in Visual Studio's code editor.

Let's see what they look like:


In this screenshot, we show three bookmarks rendered in the indicator margin on the left.  Our default implementation of bookmarks only renders glyphs in the margin, and doesn't highlight the marked line in the text area in any way (but you could optionally do this too if you wanted).

The toggle bookmark button checks to see if a bookmark is already on the caret's line.  If there is one, it removes it.  If there isn't one, it adds a new bookmark.  Clear all bookmarks removes them all from the document.

The previous and next bookmark buttons use our indicator search API to find another indicator based on an initial line.  In this case, we pass in the line that contains the caret and find the previous/next indicator.  If one is found, we move the caret to that line.


These features will be in the 2013.1 versions of the WPF and Silverlight SyntaxEditor controls.

We are still working on the design and implementation of indicators.  If you have any feature suggestions, now is the time to contact us!  Please comment here or e-mail us with your ideas and questions.

TaskDownload TaskLiveDemo TaskBuyNow

Actipro's WPF Controls

Over 100 UI controls for building beautiful Windows Presentation Foundation desktop apps.

Learn More

Over 100 UI controls for building beautiful Windows Presentation Foundation desktop apps.

Includes editors, docking windows, MDI, property grids, charts, tree controls, ribbons, gauges, themes, and much more.

Learn More Download Free Trial

Comments (2)

Posted 11 years ago by John Howe
A number of programmers editors support numbered bookmarks 0-9 dropped using Ctrl+Shift+0..9, goto as Ctrl+0..9. Been waiting for the chance to implement this, will it be possible using the new bookmarks?
Posted 11 years ago by Bill Henning (Actipro) - Actipro Software LLC
Hi John, We don't have that built in but you certainly could build on our bookmarks to add that, without too much work either. Basically you'd end up inheriting our BookmarkIndicatorTag class and add an Index property for storing the bookmark index. Then override the method that is used to create a glyph. The glyph could be a Border that contains a TextBlock bound to the Index property value. Next watch for the Ctrl+Shift+# hotkeys to know when to add a bookmark. Create the bookmark tag, set the Index, and add it to the document. Then you'll see the bookmark with the index value as the glyph in the indicator margin. Then watch for the Ctrl+# hotkeys and just find the tagged range that has the tag with that Index value. When found, move the caret to the range's start. That should give you exactly what you want.

Add Comment

Please log in to a validated account to post comments.