[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
  System Requirements
  Improve Performance
 [Expand]Features by Language
 [Expand]Getting Started
 [Expand]How To
 [Expand]Coding Assistance
 [Expand]Navigation and Search Tools
 [Expand]Static Code Analysis
 [Expand]Visualization Tools
 [Expand]Code Style Assistance
  Building Assistance
  Debugging Assistance
 [Expand]Refactoring Assistance
 [Expand]Unit Testing Assistance
 [Expand]Decompiling Tools
 [Expand]Configuration Options
   Adding a Dictionary for the Spell Checker
  [Collapse]Custom Templates Creation
    Adding a Template
    Using Text Commands
    Referencing Namespaces
    Linking Identifiers
    Providing Input Fields
    Using Variables
    Iterating Through Elements
    Template Name Variables
    Alternative Template Expansions
    Text Commands
    String Providers
  [Expand]Context Providers
   Specify a Default Filter for the Jump to Symbol Window
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Using Text Commands

You can use Text Commands to control different aspects of the expanded template. You can use Text Commands for the following tasks:

Expanded Clipboard Contents

Use the «Paste» text command to insert the clipboard contents at the specified position. You can add the corresponding text command using the first Template Editor's toolbar button.

For example, if the clipboard contains the "" string, this template expands as follows:


If you need to change the template expansion for situations when the clipboard contains no proper data, create an alternative expansion and add a context restriction to the base one. The template containing the «Paste» text command should restrict expansion when the clipboard does not contain proper data.

Expanded Caret Position

Use the «Caret» text command to put the caret at a specified position after the template expansion. You can insert the text command which marks the caret position with the second Template Editor toolbar button.

This template expands with the caret placed at the specified position, as shown below.

Expanded Selection

You can use two text commands — «Caret» and «BlockAnchor» — to select a part of your template after expansion. The text between these text commands is selected after expansion, and the caret is placed at the «Caret» text command's position. You can insert the «Caret» and «BlockAnchor» text commands using the second and third Template Editor toolbar buttons.

After expansion, this template contains the selected text block.

Expanded Markers


To enable this feature, use the Enable Markers checkbox on the Editor | All languages | Markers options page.

Use markers to label important positions in your template and jump to them after expansion with a single keystroke. You can drop markers at the required positions and collect them after the expansion. To insert the «Marker» text command, click the fourth Template Editor toolbar button.

After expansion, this template contains two markers, which can be sequentially collected using the Esc key.


If you are not sure that the marker is required, you can specify its lifetime. This deletes the marker if it is not collected after a certain period. You can pass the lifetime in seconds as a parameter to the «Marker» text command. For instance, the marker declared as «Marker(10)» is removed in ten seconds after the template expansion.

Expanded Expand Another Template

You can expand a template inside another template expansion. To insert the corresponding Text Command, right-click the template editor area and choose the Insert Alias... item from context menu.

Select the required template in the invoked editor and click OK.

This inserts the text command that expands the selected template inside your template.

Is this topic helpful?​​​​​​​