# InputFormat.FontFamily Property

> Gets or sets the font family at the current input position. If text is selected, the property specifies the font family of the whole selected text.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 16.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.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 Server > Reference > TXTextControl > InputFormat.FontFamily Property
- **933 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inputformat/fontfamily-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inputformat/fontfamily-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inputformat/fontfamily-property/llms-full.txt

---

### Description

Gets or sets the font family at the current input position. If text is selected, the property specifies the font family of the whole selected text.

### Syntax

```csharp
public string FontFamily { get; set; }
```

```vbnet
Public Property FontFamily As String
```

### Examples

The following XAML example shows how to bind a combo box to the FontFamily property using [GetFontFamilies](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inputformat/getfontfamilies-method/llms-full.txt) to fill the combo box with available font names.

```plaintext
<ComboBox
    Name="cbFontFamily"
    IsEditable="True"
    IsReadOnly="True"
    Width="150"
    DropDownOpened="cbFontFamily_DropDownOpened"
    Text="{Binding ElementName=textControl1, Path=InputFormat.FontFamily}" />
```

```csharp
private void cbFontFamily_DropDownOpened(object sender, EventArgs e) {
    cbFontFamily.ItemsSource = textControl1.InputFormat.GetFontFamilies();
}
```

```vbnet
Private Sub cbFontFamily_DropDownOpened(sender As Object, e As EventArgs)
    cbFontFamily.ItemsSource = textControl1.InputFormat.GetFontFamilies()
End Sub
```

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

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

inputFormat.FontFamily = "Arial";
if (!string.IsNullOrWhiteSpace(inputFormat.FontFamily))
{
    Console.WriteLine($"Font Family: {inputFormat.FontFamily}");
}
```

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

inputFormat.FontFamily = "Arial"
If Not String.IsNullOrWhiteSpace(inputFormat.FontFamily) Then
    Console.WriteLine($"Font Family: {inputFormat.FontFamily}")
End If
```

### Remarks

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

---

## Nearby

- **Previous:** [InputFormat.Centered Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inputformat/centered-property/llms-full.txt)
- **Next:** [InputFormat.FontSize Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/inputformat/fontsize-property/llms-full.txt)
