TX Text Control .NET for Windows Forms

UnderlineStyles Property

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

Description

Returns an array of all supported underline styles. This property can be used to fill a combo box or a menu.

Syntax

public FontUnderlineStyle[] UnderlineStyles { get; }

Members

ValueDescription
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 a menu item. The menu's header is bind to the UnderlineStyles property. The WPF.BooleanConverter returns true, if the UnderlineStyle property has the value specified through the ConverterParameter:

…
xmlns:tx="clr-namespace:TXTextControl.WPF;assembly=TXTextControl.WPF"
…
<Window.Resources>
    <tx:BooleanConverter x:Key="enumboolconv" />
</Window.Resources>
…
<MenuItem 
    IsCheckable="true" 
    Header="{Binding ElementName=textControl1, Path=InputFormat.UnderlineStyles[0], Mode=OneTime}" 
    IsChecked="{Binding 
        ElementName=textControl1, 
        Path=InputFormat.UnderlineStyle, 
        Converter={StaticResource enumboolconv}, ConverterParameter=Single}"/>

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

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

foreach (FontUnderlineStyle fontUnderlineStyle in inputFormat.UnderlineStyles)
{
    Console.WriteLine(fontUnderlineStyle);
}

Limitations

Read only.

Further Reading