Skip to main content

ListLevelProperties.CopyFrom(ListLevel) Method

Duplicates the properties of the specified list level into the current instance of the ListLevelProperties class.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public void CopyFrom(
    ListLevel listLevel
)

Parameters

Name Type Description
listLevel ListLevel

The source list level.

Remarks

The CopyFrom method duplicates the properties of the specified ListLevel object into the instance of the ListLevelProperties class that this method is called from.

Send the result ListLevelProperties object to the ChangeLevelPropertiesAsync method as a parameter to copy all properties of a list level to another level.

<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;
            List multiLevelList = await documentAPI.Lists.CreateAsync(ListType.MultiLevel);
            IReadOnlyList<ListLevel> listLevels = multiLevelList.ListLevels;
            ListLevel firstLevel = listLevels[0];
            for (int i = 1; i < 9; i++)
                await multiLevelList.ChangeLevelPropertiesAsync(i, properties => {
                    properties.CopyFrom(firstLevel);
                    properties.LeftIndent = firstLevel.LeftIndent + 300 * i;
                    if (multiLevelList.Type == ListType.Number)
                        properties.DisplayFormatString = "{" + i.ToString() + "}";
                });
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also