Skip to main content

Fields.ShowAllFieldCodesAsync(Boolean, CancellationToken) Method

Displays every field as the field code.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v24.1.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public ValueTask ShowAllFieldCodesAsync(
    bool doInAllSubDocuments = false,
    CancellationToken cancellationToken = default(CancellationToken)
)

Optional Parameters

Name Type Default Description
doInAllSubDocuments Boolean False

true to display field codes in all sub-documents; false to display field codes in the current sub-document only.

cancellationToken CancellationToken null

An object that propagates a cancellation notification.

Returns

Type Description
ValueTask

A structure that stores an awaitable result of an asynchronous operation.

Remarks

A field has the {Code}Result> structure in the text buffer, for instance, {DATE}11/2/2020>. The Code specifies how the Result should be calculated when the field is updated.

The Rich Text Editor can display a field as a code or result. Call the ShowAllFieldCodesAsync(Boolean) method to display fields as field codes, or call the ShowAllFieldResultsAsync(Boolean, CancellationToken) method to display fields as field results.

<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            await documentAPI.Fields.ShowAllFieldResultsAsync();
            await documentAPI.Fields.ShowAllFieldCodesAsync();
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Use a field’s IsShowCode property to get whether the field’s code or result is visible. Call the ToggleViewAsync(Field, CancellationToken) method to change the view mode of a field.

See Also