# Selection.Underline Property

> Gets or sets underlining styles for the selected text.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **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 > Selection.Underline Property
- **659 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/underline-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/underline-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/underline-property/llms-full.txt

---

### Description

Gets or sets underlining styles for the selected text.

### Syntax

```csharp
public FontUnderlineStyle Underline { get; set; }
```

```vbnet
Public Property Underline As FontUnderlineStyle
```

### Members

| Value | Description |
|---|---|
| None | Text is not underlined. |
| Single | Text is underlined with a single line. |
| Doubled | Text is underlined with a doubled line. |
| SingleWordsOnly | Only the words of the text are underlined with a single line. |
| DoubledWordsOnly | Only the words of the text are underlined with a doubled line. |

### Examples

The following example formats the heading of a short document by using `Selection.Underline`.

```csharp
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;

selection.Underline = FontUnderlineStyle.DoubledWordsOnly;
Console.WriteLine($"Underline used by Selection: {selection.Underline}");
```

```vbnet
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, 17)
Dim selection As Selection = textControl.Selection

selection.Underline = FontUnderlineStyle.DoubledWordsOnly
Console.WriteLine($"Underline used by Selection: {selection.Underline}")
```

### Limitations

Runtime only.

### Remarks

The property's default value is FontUnderlineStyle.None.

The property returns its default value when the text selection contains multiple characters with mixed styles. The [Selection.IsCommonValueSelected](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/iscommonvalueselected-method/llms-full.txt) method can be used to check for mixed attributes.

---

## Nearby

- **Previous:** [Selection.TextBackColor Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/textbackcolor-property/llms-full.txt)
- **Next:** [SelectionFormField Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selectionformfield/llms-full.txt)
