New to Telerik UI for WPFStart a free 30-day trial

Field

Class

Represents a field in the Telerik document model, allowing for the insertion of dynamic content within a document, such as page numbers, dates, or document properties.

Definition

Namespace:Telerik.Windows.Documents.Model

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

C#
public abstract class Field : ISupportInitialize

Inheritance: objectField

Derived Classes: CodeBasedField

Implements: ISupportInitialize

Constructors

Initializes a new instance of the Field class.

C#
public Field()

Fields

C#
protected static readonly string CodeFragmentFormat
C#
protected static readonly string DisplayNameFragmentFormat

Properties

Gets or sets the current display mode of the field.

C#
[XamlSerializable]
public FieldDisplayMode DisplayMode { get; set; }

Gets the document associated with the field.

C#
public RadDocument Document { get; }

Gets the evaluation context of a field.

C#
public EvaluationContext EvaluationContext { get; }
Property Value:

The evaluation context.

Gets the FieldRangeStart instance associated with this field.

C#
public FieldRangeStart FieldStart { get; }

Gets the name of the field type.

C#
public abstract string FieldTypeName { get; }

Gets the value indicating whether the field type has a display name fragment. If it doesn't, when its display mode is set to display name, the result fragment will be used instead.

C#
public virtual bool HasDisplayNameFragment { get; }

Methods

Copies all properties from another field of the same type.

C#
public virtual void CopyPropertiesFrom(Field fromField)
Parameters:fromFieldField

The other field, which has to be of the same type as the current instance.

Creates a deep copy of the field.

C#
public Field CreateDeepCopy()
Returns:

Field

The copy of the field.

Creates a document fragment from a string. The style properties of the elements in the fragment are based on the style properties of the FieldRangeStart and the parent paragraph.

C#
protected DocumentFragment CreateFragmentFromText(string text)
Parameters:textstring

The text to create a fragment from.

Returns:

DocumentFragment

The document fragment.

Creates a new instance of the current field class.

C#
public abstract Field CreateInstance()
Returns:

Field

The new field instance.

Gets the code fragment of the field.

C#
protected abstract DocumentFragment GetCodeFragment()
Returns:

DocumentFragment

The code fragment.

Gets the display name fragment of the field if the field has such.

C#
protected virtual DocumentFragment GetDisplayNameFragment()
Returns:

DocumentFragment

The display name fragment.

Gets a fragment of the field corresponding to mode.

C#
public DocumentFragment GetFragmentByDisplayMode(FieldDisplayMode mode)
Parameters:modeFieldDisplayMode

The display mode.

Returns:

DocumentFragment

The fragment corresponding to the display mode.

Gets one of the fragments of the field on the basis of DisplayMode.

C#
public DocumentFragment GetFragmentToDisplay()
Returns:

DocumentFragment

The fragment.

Builds the result fragment of the field.

C#
protected abstract DocumentFragment GetResultFragment()
Returns:

DocumentFragment

The result fragment.

Gets the value indicating whether the code in the code fragment is currently valid.

C#
protected abstract bool IsCodeValid()
Returns:

bool

The value indicating whether the code in the code fragment is currently valid.

C#
protected bool IsResultFragmentEmpty()
Returns:

bool

Sets the fragment of the field corresponding to mode.

C#
public void SetFragmentByDisplayMode(FieldDisplayMode mode, DocumentFragment fragment)
Parameters:modeFieldDisplayMode

The display mode.

fragmentDocumentFragment

The fragment to be set corresponding to the mode.

Sets the value of a specified property for a given Field object.

C#
public void SetPropertyValue(FieldPropertyDefinition propertyDefinition, Field nestedField)
Parameters:propertyDefinitionFieldPropertyDefinition

The definition of the property to set.

nestedFieldField

The Field object for which the property value is being set.

Sets the value of the specified property for the field.

C#
public void SetPropertyValue(FieldPropertyDefinition propertyDefinition, string value)
Parameters:propertyDefinitionFieldPropertyDefinition

The definition of the property to be set.

valuestring

The value to assign to the specified property.

Updates the field. Updates all nested fields and rebuilds the fragments.

C#
public void Update()