# TextControl.AutoControlSize Property

> Gets or sets values that enable automatic expansion or shrinking of a Text Control's width or height depending on the currently contained text. These features are only possible, if the ViewMode property has been set to SimpleControl. The property value is an object of the type AutoSize.

- **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.AutoControlSize Property
- **453 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/autocontrolsize-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/autocontrolsize-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/autocontrolsize-property/llms-full.txt

---

### Description

Gets or sets values that enable automatic expansion or shrinking of a Text Control's width or height depending on the currently contained text. These features are only possible, if the [ViewMode](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/viewmode-property/llms-full.txt) property has been set to SimpleControl. The property value is an object of the type [AutoSize](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/autosize/llms-full.txt).

### Syntax

```csharp
public AutoSize AutoControlSize { get; set; }
```

```vbnet
Public Property AutoControlSize As AutoSize
```

### Examples

The following example uses `TextControl.AutoControlSize` to configure auto control size as part of the text control workflow. The configured value is checked before the workflow continues.

```csharp
textControl.AutoControlSize = new AutoSize();
if (textControl.AutoControlSize != null)
{
    Console.WriteLine("Text Control: Auto Control Size is available.");
}
```

```vbnet
textControl.AutoControlSize = New AutoSize()
If textControl.AutoControlSize IsNot Nothing Then
    Console.WriteLine("Text Control: Auto Control Size is available.")
End If
```

---

## Nearby

- **Previous:** [TextControl.ApplicationFields Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/applicationfields-property/llms-full.txt)
- **Next:** [TextControl.BarcodeClicked Event](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/barcodeclicked-event/llms-full.txt)
