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

Paragraph.Index Property

Gets the paragraph’s index in a paragraph collection.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public int Index { get; }

Property Value

Type Description
Int32

A zero-based index.

Remarks

<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 firstParagraph = await documentAPI.Paragraphs.GetAsync(0);
            IReadOnlyList<Paragraph> paragraphs = await documentAPI.Paragraphs.GetAllAsync();
            @* ... *@
            foreach (Paragraph p in paragraphs)
                if (p.Index != 0)
                    await p.ChangePropertiesAsync(properties => {
                        properties.CopyFrom(firstParagraph);
                    });
                    @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also