ICharacterProperties.Underline Property
Returns whether characters are underlined.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.1.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
bool? Underline { get; }
Property Value
Type | Description |
---|---|
Nullable<Boolean> |
|
Remarks
A cell stores its text formatting settings in the CharacterProperties property. The Underline
property returns whether characters are underlined. The following properties affect underline appearance:
- UnderlineWordsOnly
- Returns whether space and tab characters are underlined in addition to other characters.
- UnderlineColor
- Returns the underline color. If this property is set to
Empty
, the underline color of the characters depends on the ForegroundColor property value.
Call the cell’s ChangePropertiesAsync method to change the underline color of table cell characters. The following example underlines the first row’s characters:
<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 firstRow = myTable.Rows[0];
foreach (TableCell cell in firstRow.Cells)
if (cell.CharacterProperties.Underline != true)
await cell.ChangePropertiesAsync(properties => {
properties.CharacterProperties.Underline = true;
});
richEdit.DocumentAPI.EndUpdate();
}
catch (OperationCanceledException e) {
Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
}
}
}
See Also