# TextControlDocument Class

> An object of the WPF.TextControlDocument class represents a document and is part of the template of a WPF.TextControl. It is a System.Windows.Controls.Canvas element and its size is exactly the size of the document. The document is contained in a System.Windows.Controls.ScrollViewer which is responsible for displaying the document's visible part.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 22.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
- **Inherits:** `System.Windows.Controls.Canvas`
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl.WPF > TextControlDocument Class
- **611 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontroldocument/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontroldocument/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontroldocument/llms-full.txt

---

### Description

An object of the WPF.TextControlDocument class represents a document and is part of the template of a [WPF.TextControl](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/llms-full.txt). It is a `System.Windows.Controls.Canvas` element and its size is exactly the size of the document. The document is contained in a `System.Windows.Controls.ScrollViewer` which is responsible for displaying the document's visible part.

### Syntax

```csharp
public class TextControlDocument : Canvas
```

```vbnet
Public Class TextControlDocument
    Inherits Canvas
```

### Examples

To obtain the TextControlDocument object in a [WPF.TextControl](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/llms-full.txt) the following code can be used:

```csharp
TextControlDocument document = textControl1.Template.FindName("TXPART_Document", textControl1) as TextControlDocument;
```

```vbnet
Dim document As TextControlDocument = TryCast(textControl1.Template.FindName("TXPART_Document", textControl1), TextControlDocument)
```

The following example creates a Text Control Document instance and configures its is items host setting for a document workflow.

```csharp
TXTextControl.WPF.TextControlDocument textControlDocument = new();
textControlDocument.IsItemsHost = true;
```

```vbnet
Dim textControlDocument As New TXTextControl.WPF.TextControlDocument()
textControlDocument.IsItemsHost = True
```

---

## Nearby

- **Previous:** [TextControlColors.TextColor Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrolcolors/textcolor-property/llms-full.txt)
- **Next:** [TextControlToolBar Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontroltoolbar/llms-full.txt)
