This topic covers the specific events exposed by DataProviders of RadPivotGrid control. All of the DataProviders as well as their FieldDescriptionProviders have useful events that can be used for customization purposes.

Telerik UI for WPF Ninja image

The Events is part of Telerik UI for WPF, a professional grade UI library with 160+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.

DataProvider Events

  • PrepareDescriptionForField - raised whenever the user adds a description to RadPivotFieldList.

For example you can use the event in order to replace a DoubleGroupDescription (RadPivotGrid automatically creates DoubleGroupDescription for each numeric property) with a PropertyGroupDescription as shown below:

private void OnPrepareDescriptionForField(object sender, Telerik.Pivot.Core.PrepareDescriptionForFieldEventArgs e) 
    // Get the current DoubleGroupDescription description. 
    var doubleGroupDescription = e.Description as DoubleGroupDescription; 
    if (e.DescriptionType == Telerik.Pivot.Core.DataProviderDescriptionType.Group && doubleGroupDescription != null) 
        // Replace it with PropertyGroupDescription. 
        e.Description = new Telerik.Pivot.Core.PropertyGroupDescription() { PropertyName = doubleGroupDescription.PropertyName }; 
Private Sub OnPrepareDescriptionForField(ByVal sender As Object, ByVal e As Telerik.Pivot.Core.PrepareDescriptionForFieldEventArgs) 
    ' Get the current DoubleGroupDescription description. 
    Dim doubleGroupDescription = TryCast(e.Description, DoubleGroupDescription) 
    If e.DescriptionType = Telerik.Pivot.Core.DataProviderDescriptionType.Group AndAlso doubleGroupDescription IsNot Nothing Then 
        ' Replace it with PropertyGroupDescription. 
        e.Description = New Telerik.Pivot.Core.PropertyGroupDescription() With {.PropertyName = doubleGroupDescription.PropertyName} 
    End If 
End Sub 
  • StatusChanged - raised whenever the status of the DataProvider is changed. It can be used in order to execute custom logic whenever the DataProvider is updated.

The StatusChanged event is raised on multiple threads, so it is required to use Dispatcher when executing a custom logic inside of the event handler.

You can find an example below that demonstrates how to get the current status of the DataProvider:

private void OnDataProviderStatusChanged(object sender, DataProviderStatusChangedEventArgs e) 
    if (e.NewStatus == DataProviderStatus.Ready) 
        Dispatcher.BeginInvoke(new Action(() =>  
            // Execute custom logic here. 
Private Sub OnDataProviderStatusChanged(ByVal sender As Object, ByVal e As DataProviderStatusChangedEventArgs) 
    If e.NewStatus = DataProviderStatus.Ready Then 
        Dispatcher.BeginInvoke(New Action(Sub() 
            ' Execute custom logic here. 
        End Sub)) 
    End If 
End Sub 

You can also check for errors through the Error property of the arguments.

FieldDescriptionProviders Events

FieldDescrpitionProviders are used to generate the field infos for each property from your Data/Business object. They are visualized at the top part of RadPivotFieldList.

  • GetDescriptionsDataAsyncCompleted - raised when FieldTree at the top part of RadPivotFieldList is generated. You can use the event in order to modify the FieldTree - you can add folders, reorder and modify the nodes. For example if you would need to group some of the nodes in folders you can use the following sample code:

private void OnGetDescriptionsDataAsyncCompleted(object sender, GetDescriptionsDataCompletedEventArgs e) 
    var rootItem = e.DescriptionsData.RootFieldInfo; 
    var allContainers = rootItem.Children.ToList(); 
    var firstFolder = new ContainerNode("First Folder", ContainerNodeRole.Folder); 
    var secondFolder = new ContainerNode("Second Folder", ContainerNodeRole.Folder); 
    foreach (var item in allContainers) 
        if (item.Name == "Product" || item.Name == "Quantity") 
        else if (item.Name == "Net" || item.Name == "Promotion") 
Private Sub OnGetDescriptionsDataAsyncCompleted(ByVal sender As Object, ByVal e As GetDescriptionsDataCompletedEventArgs) 
    Dim rootItem = e.DescriptionsData.RootFieldInfo 
    Dim allContainers = rootItem.Children.ToList() 
    Dim firstFolder = New ContainerNode("First Folder", ContainerNodeRole.Folder) 
    Dim secondFolder = New ContainerNode("Second Folder", ContainerNodeRole.Folder) 
    For Each item In allContainers 
        If item.Name = "Product" OrElse item.Name = "Quantity" Then 
        ElseIf item.Name = "Net" OrElse item.Name = "Promotion" Then 
        End If 
    Next item 
End Sub 

You can observe the final result on Figure 1.

Figure 1: Custom folders in the FieldTree. Rad Pivot Grid Events Overview 0

  • AddingContainerNode (available only for the LocalDataSourceFieldDescriptionsProvider) - raised multiple times while the FieldTree is generated - each time a node is added.

The event can be used in order to add and/or remove nodes from the tree.

For more details on how to add/remove nodes from the FieldTree you can check the CustomizeFieldTree example from our online SDK repository.

See Also

In this article