# Adding a Control to the Header

## Content

[C1HeaderedContentControl's](/componentone/api/wpf/online-basiclibrary/dotnet-framework-api/C1.WPF.4.6.2/C1.WPF.C1HeaderedContentControl.html) header bar is able to accept other control. In this topic, you will add a **Button** control to the header in XAML and in code.

**In XAML**

To add a Button control to the header in XAML, place the following XAML markup between the `<c1:C1HeaderedContentControl>` and `</c1:C1HeaderedContentControl>` tags:

```xml
<c1:C1HeaderedContentControl.Header>
        <Button Content="Button" Height="Auto" Width="50"/>
</c1:C1HeaderedContentControl.Header>
```

**In code**

To add a Button control to the header in code, complete the following steps:

1. Add `x:Name="C1HeaderedContentControl1"` to the `<c1:C1HeaderedContentControl>` tag so that the control will have a unique identifier for you to call in code.
2. Enter Code view and add the following code beneath the InitializeComponent() method:
<br>
    DOC-DETAILS-TAG-OPEN
<br>
    DOC-SUMMARY-TAG-OPEN
<br>
    Visual Basic
<br>
    DOC-SUMMARY-TAG-CLOSE

    ```vbnet
    'Create the Button control
    Dim NewButton As New Button()
    NewButton.Content = "Button"
    'Set the Button Control's Width and Height properties
    NewButton.Width = 50
    NewButton.Height = [Double].NaN
    'Add the Button to the header
    C1HeaderedContentControl1.Header = (NewButton)
    ```

    DOC-DETAILS-TAG-CLOSE
<br>
    DOC-DETAILS-TAG-OPEN
<br>
    DOC-SUMMARY-TAG-OPEN
<br>
    C#
<br>
    DOC-SUMMARY-TAG-CLOSE

    ```csharp
    //Create the Button control
    Button NewButton = new Button();
    NewButton.Content = "Button";
    //Set the Button Control's Width and Height properties
    NewButton.Width = 50;
    NewButton.Height = Double.NaN;
    //Add the Button to the header
    C1HeaderedContentControl1.Header=(NewButton);
    ```

    DOC-DETAILS-TAG-CLOSE
3. Run the Program.

**This topic Illustrates the following**:
As a result of this topic, a Button control will appear in the header bar. The final result will resemble the following image:
![C1WPF Basic Library - HeaderedContentControl button in header bar](https://cdn.mescius.io/document-site-files/images/7e9deccd-1f1c-4ec7-af90-b4332b45dead/controladdedtoheader-20260717.558e95.png)