# InputFormat.TextBackColor Property

> Gets or sets the color used to display the text background color at the current input position. If text is selected, the property specifies the background color of 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.TextBackColor Property
- **765 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/textbackcolor-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/textbackcolor-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/textbackcolor-property/llms-full.txt

---

### Description

Gets or sets the color used to display the text background color at the current input position. If text is selected, the property specifies the background color of the whole selected text.

### Syntax

```csharp
public Color? TextBackColor { get; set; }
```

```vbnet
Public Property TextBackColor As Color?
```

### Examples

The following XAML example shows how to bind the TextBackColor property to the fill color of a rectangle using the [WPF.ColorConverter](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/colorconverter/llms-full.txt) class.

```plaintext
…
xmlns:tx="clr-namespace:TXTextControl.WPF;assembly=TXTextControl.WPF"
…
<Window.Resources>
    <tx:ColorConverter x:Key="colorConv" />
</Window.Resources>
…
<Rectangle
    Width="20"
    Height="20">
    <Rectangle.Fill>
        <SolidColorBrush
            Color="{Binding
                ElementName=textControl1,
                Path=InputFormat.TextBackColor,
                Converter={StaticResource colorConv}}" />
    </Rectangle.Fill>
</Rectangle>
```

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

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

inputFormat.TextBackColor = System.Drawing.Color.LightSteelBlue;
if (inputFormat.TextBackColor != null)
{
    Console.WriteLine("Input Format: Text Back Color is available.");
}
```

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

inputFormat.TextBackColor = System.Drawing.Color.LightSteelBlue
If inputFormat.TextBackColor IsNot Nothing Then
    Console.WriteLine("Input Format: Text Back Color is available.")
End If
```

### Remarks

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

---

## Nearby

- **Previous:** [InputFormat.Superscript Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/superscript-property/llms-full.txt)
- **Next:** [InputFormat.TextColor Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/inputformat/textcolor-property/llms-full.txt)
