The Actipro Blog

All the latest UI control development news from Actipro

SyntaxEditor vNext - Customizing Line Numbers


As mentioned in a previous post, we have been working on refactoring the core internal implementation of our SyntaxEditor code editor control on the WPF, UWP, and WinForms platforms.  This effort is being made to bring all three platforms onto the same codebase for easier updating moving forward, and to enhance features wherever possible.

In the previous SyntaxEditor vNext post, we showed some massive improvements in SyntaxEditor touch interaction, including inertia-based touch scrolling and pinch-to-zoom features.  In today's post, we'll examine a new feature area that allows you to customize the line numbers displayed in each view's line number margin.

Default Behavior

By default, a view's line number margin displays the line number (document line index plus one) for each view line.  If a view line is a wrapped line, nothing appears for that view line in the margin.


In vNext, several new features are being added to support customization of the line number display.

Document Fragment Scenario

One scenario where line number customization is appropriate is when you have an enormous file and only want SyntaxEditor to show a fragment of it, such as several thousand lines.  In this scenario, you might make a document with lines 10,000-20,000 in it.  The first line in SyntaxEditor is really line 10,000 in the file, but it normally shows as line #1 in the line number margin.  This can be confusing to the end user.


A new property on the document class allows you to change the line number origin, which defaults to 1.  For the scenario described above, you'd set it to 10,000 instead.  All line numbers after that origin number will continue to be relative to it.

Advanced Scenarios

What about cases where a language might have specific line numbers or labels that should show for certain view lines?  This is possible too via a new language service that allows for completely customizing the text to display for each view line in the line number margin.


In the screenshot above, we've set the line number margin to show the zero-based offset of each line.  For a couple lines, we've also indicated labels for the namespace and class lines.


The new custom line numbering features are very easy to use for changing default line number margin content.

Code Writer v3 Released


We'd like to announce that the Windows 10 rewrite of Code Writer, our free text and code editor app for the Windows platform, is now available on the Windows Store for all Windows 10 users running Fall Creators Update or later.

Code Writer makes a perfect replacement for Notepad and other quick edit apps.

Reimagined Windows 10 Design

For the 3.0 version, we rebuilt the entire user interface of the app from scratch for Windows 10.  While our older v2.6 UI was great as a full screen Windows 8 app, v3.0 was made with windowed usage in mind, and delivers a much more modern interface that is a pleasure to work in.  It also makes heavy use of advanced UI features like acrylic and animations.


The new design still maintains a color bond with file types (as above where the C# file shows green in the status bar).


The list of currently-open documents is displayed in the Explorer side bar.  New documents can quickly be created there, and other existing documents can be opened.


Another new concept in v3.0 is a command palette.  This popup allows you to quickly type a portion of a command you're looking for, and the list narrows as you type.  Press Enter to execute the selected command.


The app is minimalist in nature, and while it does feature a side bar, the side bar can be collapsed by pressing the unpin button.  This affords a distraction-free environment while you edit text/code.

Code Writer has find/replace functionality, print/share support, advanced editing commands, and a wide array of settings. 


If you have the Windows 10 Fall Creators Update or later, download Code Writer for free from the Windows Store today to check out v3.0 and all it has to offer.  The new redesign has been a labor of love that has been in development for many months.  We're very pleased to get it out into your hands as a showcase of what you can do with Actipro's Universal Windows Controls.  Enjoy!

Want to get the latest news about Code Writer?  Follow our @CodeWriterApp Twitter account.

Want to chat with us about Code Writer?  Please register to join our Slack workspace and join the #codewriter channel once added.

If you are a Universal Windows app developer, you can download a free evaluation of our Universal Windows Controls to use in your own apps.  Code Writer makes use of our SyntaxEditor, Docking/MDI, PropertyGrid, and Editors controls.  SyntaxEditor is of particular interest because it lets you add advanced code and text editing to your own apps.

TaskWideLearnMore TaskWideWindowsStore

Filed under: Actipro, Apps, New features