TX Text Control .NET for WPF

UnderlineStyle Property

Property|Introduced in 16.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Gets or sets the underline style at the current input position. If text is selected, the property specifies this attribute for the whole selected text. This property determines the style for the Underline property.

Syntax

public FontUnderlineStyle UnderlineStyle { get; set; }

Members

ValueDescription
NoneText is not underlined.
SingleText is underlined with a single line.
DoubledText is underlined with a doubled line.
SingleWordsOnlyOnly the words of the text are underlined with a single line.
DoubledWordsOnlyOnly the words of the text are underlined with a doubled line.

Examples

The following XAML example binds the UnderlineStyle property to the selected value of a combo box. The combo box is filled with all supported styles:

<ComboBox 
    Height="24" 
    Name="comboboxUnderlineStyle" 
    ItemsSource="{Binding ElementName=textControl1, Path=InputFormat.UnderlineStyles, Mode=OneTime}" 
    SelectedValue="{Binding ElementName=textControl1, Path=InputFormat.UnderlineStyle, Mode=TwoWay}"/>

The following example changes the formatting applied to text entered at the end of a document by using InputFormat.UnderlineStyle.

textControl.Text = "Project summary";
textControl.InputPosition = new InputPosition(textControl.Text.Length);
InputFormat inputFormat = textControl.InputFormat;

inputFormat.UnderlineStyle = FontUnderlineStyle.DoubledWordsOnly;
Console.WriteLine($"Underline Style used by Input Format: {inputFormat.UnderlineStyle}");

Remarks

The property's default value is FontUnderlineStyle.Single.

The property returns FontUnderlineStyle.None, if the text selection has no common underline style.

Further Reading