# HeaderFooter.PageNumberFields Property

> Gets a collection of page number fields in the header or footer. The property's value is an object of the type PageNumberFieldCollection.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **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 > HeaderFooter.PageNumberFields Property
- **673 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/pagenumberfields-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/pagenumberfields-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/pagenumberfields-property/llms-full.txt

---

### Description

Gets a collection of page number fields in the header or footer. The property's value is an object of the type [PageNumberFieldCollection](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/pagenumberfieldcollection/llms-full.txt).

### Syntax

```csharp
public PageNumberFieldCollection PageNumberFields { get; }
```

```vbnet
Public ReadOnly Property PageNumberFields As PageNumberFieldCollection
```

### Examples

The following example creates a “Page X of Y” header with current-page and page-count fields.

```csharp
HeaderFooterCollection headers = textControl.Sections[1].HeadersAndFooters;
headers.Add(HeaderFooterType.Header);
HeaderFooter headerFooter = headers.GetItem(HeaderFooterType.Header);
headerFooter.Selection.Text = "Page ";
headerFooter.PageNumberFields.Add(new PageNumberField());
headerFooter.Selection.Text = " of ";
headerFooter.PageNumberFields.Add(new PageNumberField() { ShowNumberOfPages = true });
```

```vbnet
Dim headers As HeaderFooterCollection = textControl.Sections(1).HeadersAndFooters
headers.Add(HeaderFooterType.Header)
Dim headerFooter As HeaderFooter = headers.GetItem(HeaderFooterType.Header)
headerFooter.Selection.Text = "Page "
headerFooter.PageNumberFields.Add(New PageNumberField())
headerFooter.Selection.Text = " of "
headerFooter.PageNumberFields.Add(New PageNumberField() With { .ShowNumberOfPages = True })
```

### Limitations

Read only.

### See Also

Text Fields and Hypertext Links - Inserting Page Numbers.

---

## Nearby

- **Previous:** [HeaderFooter.MisspelledWords Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/misspelledwords-property/llms-full.txt)
- **Next:** [HeaderFooter.Paragraphs Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/headerfooter/paragraphs-property/llms-full.txt)
