# TextControl.CaretWidth Property

> Gets or sets the width of the caret in pixels. If this property is zero, the width is set to its default value which is the system-defined window border width.

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

---

### Description

Gets or sets the width of the caret in pixels. If this property is zero, the width is set to its default value which is the system-defined window border width.

### Syntax

```csharp
public int CaretWidth { get; set; }
```

```vbnet
Public Property CaretWidth As Integer
```

### Examples

The following example uses `TextControl.CaretWidth` to configure caret width as part of the text control workflow. The configured value is checked before the workflow continues.

```csharp
textControl.CaretWidth = 100;
Console.WriteLine($"Caret Width used by Text Control: {textControl.CaretWidth}");
```

```vbnet
textControl.CaretWidth = 100
Console.WriteLine($"Caret Width used by Text Control: {textControl.CaretWidth}")
```

### Limitations

The maximum width is 255 pixels.

---

## Nearby

- **Previous:** [TextControl.CanUndo Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/canundo-property/llms-full.txt)
- **Next:** [TextControl.Changed Event](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/changed-event/llms-full.txt)
