Skip to main content

Paragraph.ListLevelIndex Property

Gets the index of the list level to which the paragraph belongs.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public int? ListLevelIndex { get; }

Property Value

Type Description
Nullable<Int32>

The index of the list level or null if the paragraph does not belong to a list.

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 AddToListAsync(List, Int32, CancellationToken) method to add the paragraph to a list at the specified list level. The method sets the paragraph’s ListIndex and ListLevelIndex properties.

The RemoveFromListAsync(CancellationToken) method allows you to remove the paragraph from the list.

The following code snippet removes paragraphs from a list if they are placed at non-zero list levels.

<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;
            IReadOnlyList<Paragraph> paragraphs = await documentAPI.Paragraphs.GetAllAsync();
            foreach (Paragraph p in paragraphs)
                if (p.ListLevelIndex > 0)
                    await p.RemoveFromListAsync();
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also