# InputFormat.Underline Property

> Gets or sets a value specifying whether text is underlined at the current input position. The underlining style is determined through the UnderlineStyle property. If text is selected, the property specifies this attribute for the whole selected text.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 16.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > InputFormat.Underline Property
- **690 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/underline-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/underline-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/underline-property/llms-full.txt

---

### Description

Gets or sets a value specifying whether text is underlined at the current input position. The underlining style is determined through the [UnderlineStyle](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/underlinestyle-property/llms-full.txt) property. If text is selected, the property specifies this attribute for the whole selected text.

### Syntax

```csharp
public bool? Underline { get; set; }
```

```vbnet
Public Property Underline As Boolean?
```

### Examples

The following XAML example binds the Underline property to a check box:

```plaintext
<CheckBox
    Height="20"
    Name="checkBoxUnderline"
    IsChecked="{Binding ElementName=textControl1, Path=InputFormat.Underline, Mode=TwoWay}">
    Underline</CheckBox>
```

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

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

inputFormat.Underline = true;
if (inputFormat.Underline != null)
{
    Console.WriteLine("Input Format: Underline is available.");
}
```

```vbnet
textControl.Text = "Project summary"
textControl.InputPosition = New InputPosition(textControl.Text.Length)
Dim inputFormat As InputFormat = textControl.InputFormat

inputFormat.Underline = True
If inputFormat.Underline IsNot Nothing Then
    Console.WriteLine("Input Format: Underline is available.")
End If
```

### Remarks

The property returns null when the text selection contains multiple characters with mixed styles.

---

## Nearby

- **Previous:** [InputFormat.TopFrameLine Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/topframeline-property/llms-full.txt)
- **Next:** [InputFormat.UnderlineStyle Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/underlinestyle-property/llms-full.txt)
