# IFormattedText.Selection Property

> Gets or sets the current selection in the text part. The property value is an object of the type Selection. A selection can be used to assign character and paragraph formatting attributes to a piece of 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 > IFormattedText.Selection Property
- **305 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/iformattedtext/selection-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/iformattedtext/selection-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/iformattedtext/selection-property/llms-full.txt

---

### Description

Gets or sets the current selection in the text part. The property value is an object of the type [Selection](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/llms-full.txt). A selection can be used to assign character and paragraph formatting attributes to a piece of text.

### Syntax

```csharp
Selection Selection { get; set; }
```

```vbnet
Property Selection As Selection
```

### Examples

The following example updates the formatted text part's selection and applies it back to that text part.

```csharp
Selection selection = iFormattedText.Selection;
selection.Bold = true;
iFormattedText.Selection = selection;
```

```vbnet
Dim selection As Selection = iFormattedText.Selection
selection.Bold = True
iFormattedText.Selection = selection
```

---

## Nearby

- **Previous:** [IFormattedText.Paragraphs Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/iformattedtext/paragraphs-property/llms-full.txt)
- **Next:** [IFormattedText.SubTextParts Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/iformattedtext/subtextparts-property/llms-full.txt)
