Paragraph.RemoveFromListAsync(CancellationToken) Method
Removes the paragraph from a list.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
public ValueTask<bool> RemoveFromListAsync(
CancellationToken cancellationToken = default(CancellationToken)
)
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
cancellationToken | CancellationToken | null | An object that propagates a cancellation notification. |
Returns
Type | Description |
---|---|
ValueTask<Boolean> | A structure that stores an awaitable result of an asynchronous operation. The awaitable result is |
Remarks
A list in a document is a series of paragraphs. Each paragraph contains information about the list (ListIndex) and the list level (ListLevelIndex) to which it belongs, if any.
Call the RemoveFromListAsync
method to set the paragraph’s ListIndex and ListLevelIndex properties to null
, remove the list format style from the paragraph, and remove the paragraph from the list.
<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;
@* ... *@
Paragraph par6 = await documentAPI.Paragraphs.CreateAsync();
await documentAPI.AddTextAsync("Paragraph 6");
await par6.AddToListAsync(list);
//...
await par6.RemoveFromListAsync();
@* ... *@
}
catch (OperationCanceledException e) {
Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
}
}
Call the AddToListAsync(List, Int32, CancellationToken) method to add a paragraph to a list.