Example #1
0
 /// <summary>
 /// The event handler method is hooked when the radio button was clicked.
 /// </summary>
 /// <param name="sender">The radio button.</param>
 /// <param name="e">The event argument.</param>
 private void OlapDataSource_Checked(object sender, RoutedEventArgs e)
 {
     RootLayout.Children.RemoveAt(0);
     pivotGrid = new SfPivotGrid {
         Margin = new Thickness(5)
     };
     pivotGrid.SetBinding(SfPivotGrid.ShowGroupingBarProperty, showGroupingBarBinding);
     pivotGrid.SetBinding(SfPivotGrid.EnableGroupingBarFilteringProperty, enableGroupingBarFilteringBinding);
     pivotGrid.SetBinding(SfPivotGrid.EnableGroupingBarRemovingProperty, enableGroupingBarRemovingBinding);
     pivotGrid.SetBinding(SfPivotGrid.EnableRowHeaderAreaProperty, enableRowHeaderBinding);
     pivotGrid.SetBinding(SfPivotGrid.EnableColumnHeaderAreaProperty, enableColumnHeaderBinding);
     pivotGrid.SetBinding(SfPivotGrid.EnableFilterHeaderAreaProperty, enableFilterHeaderBinding);
     pivotGrid.SetBinding(SfPivotGrid.EnableValueHeaderAreaProperty, enableValueHeaderBinding);
     chk_EnableGroupingBarSorting.Visibility = Visibility.Collapsed;
     pivotGrid.SetBinding(SfPivotGrid.AllowMultiFunctionalSortFilterProperty, allowMultiFunctionalSortFilterBinding);
     chk_AllowMultiFunctionalSortFilter.Visibility = Visibility.Collapsed;
     busyIndicator.IsBusy = true;
     Task.Run(async() =>
     {
         var dispatcher           = CoreApplication.MainView.CoreWindow.Dispatcher;
         var taskCompletionSource = new TaskCompletionSource <bool>();
         await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             pivotGrid.OlapDataManager = vm.OlapDataManager;
             RootLayout.Children.Insert(0, pivotGrid);
             taskCompletionSource.SetResult(true);
             busyIndicator.IsBusy = false;
         });
         await taskCompletionSource.Task;
     });
 }
Example #2
0
        /// <summary>
        /// The event handler method is hooked when the radio button was clicked.
        /// </summary>
        /// <param name="sender">The radio button.</param>
        /// <param name="e">The event argument.</param>
        private void RelationalDataSource_Checked(object sender, RoutedEventArgs e)
        {
            RootLayout.Children.RemoveAt(0);
            pivotGrid = new SfPivotGrid {
                Margin = new Thickness(5)
            };
            if (DeviceFamily.GetDeviceFamily() == Devices.Mobile && pivotGrid.ConditionalFormats != null)
            {
                pivotGrid.ConditionalFormats.Clear();
            }
            pivotGrid.SetBinding(SfPivotGrid.ShowGroupingBarProperty, showGroupingBarBinding);
            pivotGrid.SetBinding(SfPivotGrid.EnableGroupingBarFilteringProperty, enableGroupingBarFilteringBinding);
            pivotGrid.SetBinding(SfPivotGrid.EnableGroupingBarRemovingProperty, enableGroupingBarRemovingBinding);
            pivotGrid.SetBinding(SfPivotGrid.EnableGroupingBarSortingProperty, enableGroupingBarSortingBinding);
            pivotGrid.SetBinding(SfPivotGrid.EnableRowHeaderAreaProperty, enableRowHeaderBinding);
            pivotGrid.SetBinding(SfPivotGrid.EnableColumnHeaderAreaProperty, enableColumnHeaderBinding);
            pivotGrid.SetBinding(SfPivotGrid.EnableFilterHeaderAreaProperty, enableFilterHeaderBinding);
            pivotGrid.SetBinding(SfPivotGrid.EnableValueHeaderAreaProperty, enableValueHeaderBinding);
            chk_EnableGroupingBarSorting.Visibility = Visibility.Visible;
            pivotGrid.SetBinding(SfPivotGrid.AllowMultiFunctionalSortFilterProperty, allowMultiFunctionalSortFilterBinding);
            chk_AllowMultiFunctionalSortFilter.Visibility = Visibility.Visible;
            busyIndicator.IsBusy = true;
            Task.Run(async() =>
            {
                var dispatcher           = CoreApplication.MainView.CoreWindow.Dispatcher;
                var taskCompletionSource = new TaskCompletionSource <bool>();
                await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    pivotGrid.ItemSource = vm.ProductSalesData;
                    // Adding rows to SfPivotGrid

                    pivotGrid.PivotRows.Add(new Syncfusion.PivotAnalysis.UWP.PivotItem()
                    {
                        FieldMappingName = "Product", TotalHeader = "Total"
                    });
                    pivotGrid.PivotRows.Add(new Syncfusion.PivotAnalysis.UWP.PivotItem()
                    {
                        FieldMappingName = "Date", TotalHeader = "Total"
                    });

                    // Adding columns to SfPivotGrid
                    pivotGrid.PivotColumns.Add(new Syncfusion.PivotAnalysis.UWP.PivotItem()
                    {
                        FieldMappingName = "Country", TotalHeader = "Total"
                    });
                    pivotGrid.PivotColumns.Add(new Syncfusion.PivotAnalysis.UWP.PivotItem()
                    {
                        FieldMappingName = "State", TotalHeader = "Total"
                    });

                    // Adding calculations to SfPivotGrid

                    pivotGrid.PivotCalculations.Add(new PivotComputationInfo()
                    {
                        FieldHeader = "Amount", FieldName = "Amount", Format = "C", SummaryType = SummaryType.DoubleTotalSum
                    });
                    pivotGrid.PivotCalculations.Add(new PivotComputationInfo()
                    {
                        FieldHeader = "Quantity", FieldName = "Quantity", Format = "#.##", SummaryType = SummaryType.Count
                    });

                    RootLayout.Children.Insert(0, pivotGrid);
                    taskCompletionSource.SetResult(true);
                    busyIndicator.IsBusy = false;
                });
                await taskCompletionSource.Task;
            });
        }