[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]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Collapse]CodeRush
  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
 [Collapse]Extensibility
   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)

Providing Input Fields

If your template contains strings that will likely be changed after expansion, you can use Text Fields for their definition. As a result, these strings will be marked as editable after expansion.

Expanded Simple Text Field

To insert the text field into the template code, use the «Field(default_value,description)» text command, which can be inserted using the Insert a Field toolbar button.

Important

The Insert a Field toolbar button inserts the «Field» text command with a non-specified default value and description. You should manually add value and description into this text command.

Expanded Group of Text Fields

A template with multiple text fields acts like a form: after such a template has been expanded, CodeRush prompts an end-user to fill required text fields sequentially. To specify the first form item, use the «Caret» and «BlockAnchor» Text Commands. You can specify the final caret position using the «FinalTarget» text command, which can be inserted using the Insert a FinalTarget command toolbar button.

The template presented above will expand as follows.

When a text field is active, you can use the following keys for navigation.

Key/Shortcut Action
Enter Accepts the contents of the active text field and activates the next text field or moves the caret to the «FinalTarget» position.
Ctrl+Shift+Enter Accepts the contents of all text fields in the active document and moves the caret to the «FinalTarget» position.
Tab Activates the next text field
Shift+Tab Activates the previous text field

Expanded Text Field Containing Linked Identifier

The «Field(default_value,description)» text command has another notation, which allows you to combine text commands: «FieldStart(description)»default_value«FieldEnd». Using this notation, you can combine the linked identifier with the text field. To insert a text field containing the linked identifier, use the Insert a Link command surrounded by FieldStart and FieldEnd commands toolbar button.

Important

The Insert a Link command surrounded by FieldStart and FieldEnd commands toolbar button inserts the «FieldStart»«Link»«FieldEnd» text command with a non-specified linked identifier and description. You should manually add them into this text command.

The template presented above will expand as follows.

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