Skip to main content
All docs
V24.1

ICharacterProperties.Hidden Property

Returns whether content is hidden.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

bool? Hidden { get; }

Property Value

Type Description
Nullable<Boolean>

true if content is hidden; false if content is visible; null if only some content is hidden.

Remarks

The Hidden property defines whether content is hidden. Select the HomeShow/Hide ¶ ribbon command to show/hide hidden content. The Rich Text Editor underlines hidden content with a dotted line.

Rich Edit - Hidden Characters

A cell stores its text formatting settings in the CharacterProperties property. Call the cell’s ChangePropertiesAsync method to show or hide table cell content.

The following example hides the last column’s content:

<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);
            foreach (TableRow row in myTable.Rows) {
                var lastCell = row.Cells[columnCount - 1];
                if (lastCell.CharacterProperties.Hidden != true)
                    await lastCell.ChangePropertiesAsync(properties => {
                        properties.CharacterProperties.Hidden = true;
                    });
            }
            richEdit.DocumentAPI.EndUpdate();
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}
See Also