New to Telerik UI for WinForms? Start a free 30-day trial

Builds a field-code expression from a field type, an optional argument, and ordered switches.

Definition

Namespace:Telerik.WinForms.Documents.Model.Fields.CodeExpressions

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class FieldCodeBuilder

Inheritance: objectFieldCodeBuilder

Constructors

Creates a builder initialized with the specified field type.

C#
public FieldCodeBuilder(string fieldType)
Parameters:fieldTypestring

The field type identifier written at the start of the code.

Exceptions: ArgumentException

fieldType is null or empty.

Methods

Adds a switch with the value of a field property as its argument. An empty literal property value omits the switch; a nested field is retained as a nested argument.

C#
public void AddSwitch(string switchCharacters, FieldProperty prop)
Parameters:switchCharactersstring

The switch token, including its leading backslash.

propFieldProperty

The property supplying the switch argument.

Adds a switch that has no argument.

C#
public void AddSwitch(string switchCharacters)
Parameters:switchCharactersstring

The switch token, including its leading backslash.

Gets the code expression as inline elements, including the surrounding field delimiters.

C#
public IEnumerable<Inline> GetCodeExpressionFragment()
Returns:

IEnumerable<Inline>

The inline representation of the code expression.

Gets the field-code text without the surrounding field delimiters.

C#
public string GetResultCode()
Returns:

string

The field type, argument, and switches joined as code text.

Parses the supplied field-code text and replaces the current expression. If the text contains no tokens, the expression becomes null; a later non-empty parse or Reset() restores it.

C#
public void RebuildFromCode(string fieldCode)
Parameters:fieldCodestring

The field-code text to parse.

Clears the current argument and switches and restores the builder's original field type.

C#
public void Reset()

Sets the field's argument from a property, retaining nested fields as nested arguments. An empty literal value clears the argument.

C#
public void SetFieldArgument(FieldProperty prop)
Parameters:propFieldProperty

The property supplying the field argument.