# Customizing the Dialogs

To customize the dialogs in **RadPivotGrid**/**RadPivotFieldList**, you can either inherit from them to override/extend the base functionality or you can create an entirely custom dialogs by implementing the corresponding dialog interface.

> caption Figure 1: Custom Header Text

![WinForms RadPivotGrid Custom Header Text](https://www.telerik.com/products/winforms/documentation/assets/2c20a3bea2331500082538980a52efed/pivotgrid-dialogs-customizing-the-dialogs001.png)

#### Custom AggregateOptionsDialog

The functions list displayed in the dialog can be modified. It can also be extended with custom aggregate functions. The example below adds the sample *SqrtSumAggregateFunction* to the list with the default functions.

> note The [Custom Aggregation](https://www.telerik.com/products/winforms/documentation/controls/pivotgrid/custom-aggregation) article discusses in details the API for creating custom functions as well as it includes the source code of the custom function used below.

```C#
class MyAggregateOptionsDialog : AggregateOptionsDialog
{
    public override void LoadSettings(Telerik.Pivot.Core.PropertyAggregateDescriptionBase aggregateDescription)
    {
        base.LoadSettings(aggregateDescription);
        this.Text = "This is a custom dialog";
    }

    protected override IEnumerable<object> GetDefaultAggregateFunctions(AggregateDescriptionBase aggregateDescription)
    {
        IEnumerable<object> functions = base.GetDefaultAggregateFunctions(aggregateDescription);
        IEnumerable<object> customFunctions = functions.Concat(new List<object> { new SqrtSumAggregateFunction() });

        return customFunctions;

    }
}
```

```VB.NET
Class MyAggregateOptionsDialog
    Inherits AggregateOptionsDialog
    Public Overrides Sub LoadSettings(aggregateDescription As Telerik.Pivot.Core.PropertyAggregateDescriptionBase)
        MyBase.LoadSettings(aggregateDescription)
        Me.Text = "This is a custom dialog"
    End Sub

    Protected Overrides Function GetDefaultAggregateFunctions(ByVal aggregateDescription As AggregateDescriptionBase) As IEnumerable(Of Object)
        Dim functions As IEnumerable(Of Object) = MyBase.GetDefaultAggregateFunctions(aggregateDescription)
        Dim customFunctions As IEnumerable(Of Object) = functions.Concat(New List(Of Object) From {New SqrtSumAggregateFunction()})
        Return customFunctions
    End Function


End Class
```

When RadPivotGrid and **RadPivotFieldList** need a dialog, they use the **PivotGridDialogsFactory** to create an instance of a dialog. To replace the default dialogs with your custom ones, you need to implement a custom factory as show below.

#### Custom PivotGridDialogsFactory

```C#
class MyDialogsFactory : PivotGridDialogsFactory
{
    public override IAggregateOptionsDialog CreateAggregateOptionsDialog()
    {
        return new MyAggregateOptionsDialog();
    }
}
```

```VB.NET
Class MyDialogsFactory
    Inherits PivotGridDialogsFactory
    Public Overrides Function CreateAggregateOptionsDialog() As IAggregateOptionsDialog
        Return New MyAggregateOptionsDialog()
    End Function
End Class
```

Then, you need to assign it to RadPivotGrid and RadPivotFieldList:

#### Set Custom Factory

```C#
this.radPivotGrid1.DialogsFactory = new MyDialogsFactory();
this.radPivotFieldList1.DialogsFactory = new MyDialogsFactory();
```

```VB.NET
Me.radPivotGrid1.DialogsFactory = New MyDialogsFactory()
Me.radPivotFieldList1.DialogsFactory = New MyDialogsFactory()
```

## See Also

* [Dialogs Overview](https://www.telerik.com/products/winforms/documentation/controls/pivotgrid/dialogs/overview)
* [Custom Aggregation](https://www.telerik.com/products/winforms/documentation/controls/pivotgrid/custom-aggregation)
