Skip to main content
A newer version of this page is available. .

Paragraph.ListLevelIndex Property

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

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v21.2.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) 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() method allows you to remove the paragraph from the list.

The code sample below 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 cancelled. */
        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