Back to Devexpress

Paragraph.RemoveFromListAsync(CancellationToken) Method

blazor-devexpress-dot-blazor-dot-richedit-dot-paragraph-dot-removefromlistasync-x28-system-dot-threading-dot-cancellationtoken-x29.md

latest3.2 KB
Original Source

Paragraph.RemoveFromListAsync(CancellationToken) Method

Removes the paragraph from a list.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
public ValueTask<bool> RemoveFromListAsync(
    CancellationToken cancellationToken = default(CancellationToken)
)

Optional Parameters

NameTypeDefaultDescription
cancellationTokenCancellationTokennull

An object that propagates a cancellation notification.

|

Returns

TypeDescription
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.

razor
<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.

See Also

Paragraph Class

Paragraph Members

DevExpress.Blazor.RichEdit Namespace