New to Telerik UI for Silverlight? Download free 30-day trial

Drill Down

As of R1 2017, LocalDataSourceProvider exposes a GetUnderlyingData method that allows you to extract the records from your ItemsSource that were used for accumulating the result for a particular row and column. The GetUnderlyingData method takes two parameters: Row Group and Column Group.

Example 1: Calling GetUnderlyingData on Cell Double-Click

private void pivotGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 
    if (e.ClickCount == 2) 
        var pivotGrid = sender as RadPivotGrid; 
        if (pivotGrid != null) 
            var cellData = (e.OriginalSource as FrameworkElement).DataContext as CellData; 
            if (cellData != null) 
                var cellAggregateValue = cellData.Data as CellAggregateValue; 
                var localProvider = pivotGrid.DataProvider as LocalDataSourceProvider; 
                if (localProvider != null) 
                    localProvider.GetUnderlyingData(cellAggregateValue.RowGroup, cellAggregateValue.ColumnGroup); 

Once RadPivotGrid has finished processing the underlying data, the newly-introduced GetUnderlyingDataCompleted event will be fired. Its DrillDownCompletedEventArgs have two properties:

  • Result: An IEnumerable representing the result of the underlying data extraction operation.
  • InnerExceptions: A read-only collection of any exceptions thrown during the underlying data extraction.

If the DeferUpdates property of the LocalDataSourceProvider is set to True, calling the GetUnderlyingData method without first updating the provider will result in an InvalidOperationException which will be passed to the DrillDownCompletedEventArgs' InnerExceptions collection.

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

Example 2: The GetUnderlyingDataCompleted Event Handler

private void dataProvider_GetUnderlyingDataCompleted(object sender, DrillDownCompletedEventArgs e) 
    Dispatcher.BeginInvoke(new Action(() =>  
        if (e.InnerExceptions.Count() == 0) 
            this.underlyingDataGridView.ItemsSource = e.Result; 
            this.errorText = e.InnerExceptions.First().Message; 
Private Sub dataProvider_GetUnderlyingDataCompleted(ByVal sender As Object, ByVal e As DrillDownCompletedEventArgs) 
        Dispatcher.BeginInvoke(New Action(Sub() 
            If e.InnerExceptions.Count() = 0 Then 
                Me.underlyingDataGridView.ItemsSource = e.Result 
                Me.errorText = e.InnerExceptions.First().Message 
            End If 
        End Sub)) 
End Sub 

A better example of the Drill Down functionality can be found here.

See Also

In this article
Not finding the help you need? Improve this article