blazor-devexpress-dot-blazor-dot-richedit-dot-fields-dot-showallfieldcodesasync-x28-system-dot-boolean-system-dot-threading-dot-cancellationtoken-x29.md
Displays every field as the field code.
Namespace : DevExpress.Blazor.RichEdit
Assembly : DevExpress.Blazor.RichEdit.v25.2.dll
NuGet Package : DevExpress.Blazor.RichEdit
public ValueTask ShowAllFieldCodesAsync(
bool doInAllSubDocuments = false,
CancellationToken cancellationToken = default(CancellationToken)
)
| 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.
|
| Type | Description |
|---|---|
| ValueTask |
A structure that stores an awaitable result of an asynchronous operation.
|
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