Skip to main content
All docs
V24.1

ICharacterProperties.Strikeout Property

Returns whether characters are stricken out.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

bool? Strikeout { get; }

Property Value

Type Description
Nullable<Boolean>

true if all characters are stricken out; false if no character is stricken out; null if only some characters are stricken out.

Remarks

A cell stores its text formatting settings in the CharacterProperties property. Call the cell’s ChangePropertiesAsync method to apply or remove the strikeout font attribute to all cell characters. The ForegroundColor property defines the color of the line that strikes characters out.

The following example strikes out all characters in the second row of a table:

<DxRichEdit @ref="richEdit" />

@code {
    DxRichEdit richEdit;
    protected override async Task OnAfterRenderAsync(bool firstRender) {
        if (firstRender)
            try {
                await InitializeDocument();
            }
            catch (TaskCanceledException) { }
        await base.OnAfterRenderAsync(firstRender);
    }

    async Task InitializeDocument() {
    /* 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 {
            var columnCount = 4;
            var rowCount = 5;
            richEdit.DocumentAPI.BeginUpdate();
            // Creates a table
            Table myTable = await richEdit.DocumentAPI.Tables.CreateAsync(0, columnCount, rowCount);
            for (int i = rowCount-1; i >=0 ; i--)
                for (int j = columnCount-1; j >=0 ; j--) {
                    var cellPosition = myTable.Rows[i].Cells[j].Interval.Start;
                    await richEdit.DocumentAPI.AddTextAsync(cellPosition, "sample text");
                }
            // Customizes the table
            myTable = await richEdit.DocumentAPI.Tables.GetAsync(0);
            var secondRow = myTable.Rows[1];
            foreach (TableCell cell in secondRow.Cells)
                if (cell.CharacterProperties.Strikeout != true)
                    await cell.ChangePropertiesAsync(properties => {
                        properties.CharacterProperties.Strikeout = true;
                    });
            richEdit.DocumentAPI.EndUpdate();
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}
See Also