Skip to main content

Field.IsShowCode Property

Gets whether the field’s code or result is visible.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public bool IsShowCode { get; }

Property Value

Type Description
Boolean

true if the field code is visible; false if the field result is visible.

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. A field’s IsShowCode property allows you 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.

<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;
            @* ... *@
            // Gets the first field in the main sub-document
            Field myField = await documentAPI.Fields.GetAsync(0);
            // If the Rich Text Editor displays the first field as a code, displays the field as a result
            if (myField.IsShowCode)
                await documentAPI.Fields.ToggleViewAsync(myField);
                @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Use the following methods to change the display mode of every field in a sub-document or in all sub-documents:

See Also