Paragraph.RemoveFromListAsync() Method
Removes the paragraph from a list.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v21.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
public ValueTask<bool> RemoveFromListAsync()
Returns
Type | Description |
---|---|
ValueTask<Boolean> | A structure that stores an awaitable result of an asynchronous operation. The awaitable result is true if the operation ends successfully; otherwise, it is false. |
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 cancelled. */
try {
documentAPI = richEdit.DocumentAPI;
@* ... *@
Paragraph par5 = await documentAPI.Paragraphs.CreateAsync();
await documentAPI.AddTextAsync("Paragraph 5");
await par5.AddToListAsync(list);
//...
await par5.RemoveFromListAsync();
@* ... *@
}
catch (OperationCanceledException e) {
Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
}
}
Call the AddToListAsync(List, Int32) method to add a paragraph to a list.