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

Base for fields that build a field-code fragment from shared formatting switches and type-specific code.

Definition

Constructors

Initializes a new instance of the CodeBasedField class.

C#
public CodeBasedField()

Fields

The date time formatting.

C#
public static readonly FieldPropertyDefinition DateTimeFormattingProperty

The general formatting.

C#
public static readonly FieldPropertyDefinition GeneralFormattingProperty

The numeric formatting.

C#
public static readonly FieldPropertyDefinition NumericFormattingProperty

Properties

Gets the FieldCodeBuilder used to create the code fragment of the field.

C#
protected FieldCodeBuilder CodeBuilder { get; }

Supplies the value of the @ date/time formatting switch in the generated field code.

C#
[XamlSerializable]
public string DateTimeFormatting { get; set; }

Gets the code of the field.

C#
public string FieldCode { get; }

Supplies the value of the * general-format switch in the generated field code.

C#
[XamlSerializable]
public string GeneralFormatting { get; set; }

Supplies the value of the # numeric-format switch in the generated field code.

C#
[XamlSerializable]
public string NumericFormatting { get; set; }

Methods

Builds the field-specific parts of the code fragment, using the current CodeBuilder.

C#
protected virtual void BuildCodeOverride()

Copies all properties from another field of the same type.

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

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

Overrides: Field.CopyPropertiesFrom(Field)

Copies the properties of the field from a FieldCodeExpression instance.

C#
public void CopyPropertiesFrom(FieldCodeExpression fieldCodeExpression)
Parameters:fieldCodeExpressionFieldCodeExpression

The field code expression.

Copies the field-specific properties from a FieldCodeExpression.

C#
protected virtual void CopyPropertiesFromCodeExpression(FieldCodeExpression fieldCodeExpression)
Parameters:fieldCodeExpressionFieldCodeExpression

The field code expression.

Gets the code fragment of the field. If the code is currently not valid, it will be rebuilt.

C#
protected override DocumentFragment GetCodeFragment()
Returns:

DocumentFragment

The code fragment

Overrides: Field.GetCodeFragment()

Formats an integer using this field's general-format switch value.

C#
protected string GetNumberResultWithFormatting(int number)
Parameters:numberint

The integer to format.

Returns:

string

The formatted number as text.

Invalidates the code fragment of the field. The next time the code fragment is requested, it will be built anew.

C#
protected void InvalidateCode()

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

C#
protected override bool IsCodeValid()
Returns:

bool

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

Overrides: Field.IsCodeValid()

Creates a fragment whose content is enclosed by hyperlink markers described by hyperlinkInfo.

C#
protected DocumentFragment MakeHyperlinkFragment(DocumentFragment fragment, HyperlinkInfo hyperlinkInfo)
Parameters:fragmentDocumentFragment

The content to place inside the hyperlink.

hyperlinkInfoHyperlinkInfo

The hyperlink metadata applied to the content.

Returns:

DocumentFragment

The fragment containing the hyperlink range.