Back to Devexpress

List.Type Property

blazor-devexpress-dot-blazor-dot-richedit-dot-list-9fab2103.md

latest2.8 KB
Original Source

List.Type Property

Gets the type of a list.

Namespace : DevExpress.Blazor.RichEdit

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

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

csharp
public ListType Type { get; }

Property Value

TypeDescription
ListType

The list type.

|

Available values:

NameDescription
MultiLevel

The multilevel list.

| | Number |

The numbered list.

| | Bullet |

The bulleted list.

|

Remarks

Pass the ListType enumeration’s value to the CreateAsync(ListType, CancellationToken) method to create a list of the specified type. The type of an existing list cannot be changed.

The list type defines default settings for list levels. Call the ChangeLevelPropertiesAsync(Int32, Action<ListLevelProperties>, CancellationToken) method to customize list level properties.

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;
            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

List Class

List Members

DevExpress.Blazor.RichEdit Namespace