private void SetCustomTooltip(GroupBox grpBox)
        {
            CheckBox allGroup       = grpBox.FindName("chkBoxEnableCustom_All") as CheckBox;
            CheckBox colGroup       = grpBox.FindName("chkBoxCustomColHeader") as CheckBox;
            CheckBox rowGroup       = grpBox.FindName("chkBoxCustomRowHeader") as CheckBox;
            CheckBox valGroup       = grpBox.FindName("chkBoxCustomValCell") as CheckBox;
            CheckBox sumHeaderGroup = grpBox.FindName("chkBoxCustomSumHeader") as CheckBox;
            CheckBox sumCellGroup   = grpBox.FindName("chkBoxCustomSumCell") as CheckBox;

            this.Target.CustomToolTipTemplateKey = null;
            if (colGroup != null && colGroup.IsChecked == true)
            {
                this.Target.ColumnHeaderCellStyle.CustomToolTipTemplateKey = "ColumnTemplateTooltip";
            }
            if (rowGroup != null && rowGroup.IsChecked == true)
            {
                this.Target.RowHeaderCellStyle.CustomToolTipTemplateKey = "RowTemplateTooltip";
            }
            if (valGroup != null && valGroup.IsChecked == true)
            {
                this.Target.ValueCellStyle.CustomToolTipTemplateKey = "ValueTemplateTooltip";
            }
            if (sumHeaderGroup != null && sumHeaderGroup.IsChecked == true)
            {
                this.Target.SummaryHeaderStyle.CustomToolTipTemplateKey = "SummaryHeaderTemplateTooltip";
            }
            if (sumCellGroup != null && sumCellGroup.IsChecked == true)
            {
                this.Target.SummaryCellStyle.CustomToolTipTemplateKey = "SummaryCellTemplateTooltip";
            }
        }
示例#2
0
        private void GroupBox_Loaded(object sender, RoutedEventArgs e)
        {
            GroupBox          gb = (GroupBox)sender;
            PanelPartEmbedded pp = (PanelPartEmbedded)gb.DataContext;
            PartView          pv = DashboardClient.PartViews.GetOrThrow(pp.Content.GetType());

            if (pv.OnTitleClick != null && (pv.IsTitleEnabled == null || pv.IsTitleEnabled()))
            {
                TextBlock tb = (TextBlock)gb.FindName("tb");
                tb.Cursor     = Cursors.Hand;
                tb.MouseDown += TextBlock_MouseUp;
            }

            Button button = (Button)gb.FindName("navigate");

            if (pv.FullScreen == null)
            {
                button.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                button.Click += fullScreen_Click;
            }
        }
示例#3
0
        protected override void Invoke(object parameter)
        {
            RoutedEventArgs  eventArgs        = parameter as RoutedEventArgs;
            CheckBox         current          = eventArgs != null ? eventArgs.OriginalSource as CheckBox : null;
            PivotGridControl pivot            = (this.Target.Children[1] is Grid) ? (this.Target.Children[1] as Grid).Children[0] as PivotGridControl : null;
            TabControl       TabControlExt    = VisualTreeHelper.GetChild(Target.Children[1], 2) as TabControl;
            GroupBox         subtotalGroupBox = TabControlExt != null?TabControlExt.FindName("ShowSubTotalGroupBox") as GroupBox : null;

            CheckBox showAllSubTotals = subtotalGroupBox != null?subtotalGroupBox.FindName("chkShowSubTotals") as CheckBox : null;

            CheckBox showProductSubTotals = subtotalGroupBox != null?subtotalGroupBox.FindName("chkShowProductSubTotals") as CheckBox : null;

            CheckBox showDateSubTotals = subtotalGroupBox != null?subtotalGroupBox.FindName("chkShowDateSubTotals") as CheckBox : null;

            CheckBox showCountrySubTotals = subtotalGroupBox != null?subtotalGroupBox.FindName("chkShowCountrySubTotals") as CheckBox : null;

            CheckBox showStateSubTotals = subtotalGroupBox != null?subtotalGroupBox.FindName("chkShowStateSubTotals") as CheckBox : null;

            CheckBox showRowSubTotals = subtotalGroupBox != null?subtotalGroupBox.FindName("chkShowRowSubTotals") as CheckBox : null;

            CheckBox showColumnSubTotals = subtotalGroupBox != null?subtotalGroupBox.FindName("chkShowColumnSubTotals") as CheckBox : null;

            ComboBox cmbBox = eventArgs != null ? eventArgs.OriginalSource as ComboBox : null;
            CheckBox showCalculationAsColumnsCheckBox = TabControlExt.FindName("chkShowCalculationsAsColumns") as CheckBox;

            if (cmbBox != null)
            {
                switch (cmbBox.SelectedItem.ToString())
                {
                case "Normal":
                    pivot.GridLayout = Syncfusion.PivotAnalysis.Base.GridLayout.Normal;
                    if (subtotalGroupBox != null && showCalculationAsColumnsCheckBox != null)
                    {
                        subtotalGroupBox.IsEnabled = true;
                        showCalculationAsColumnsCheckBox.IsEnabled = true;
                    }
                    break;

                case "Top Summary":
                    pivot.GridLayout = Syncfusion.PivotAnalysis.Base.GridLayout.TopSummary;
                    if (subtotalGroupBox != null && showCalculationAsColumnsCheckBox != null)
                    {
                        subtotalGroupBox.IsEnabled = true;
                        showCalculationAsColumnsCheckBox.IsEnabled = true;
                    }
                    break;

                case "Excel Like Layout":
                    pivot.GridLayout = Syncfusion.PivotAnalysis.Base.GridLayout.ExcelLikeLayout;
                    if (subtotalGroupBox != null && showCalculationAsColumnsCheckBox != null)
                    {
                        subtotalGroupBox.IsEnabled = false;
                        showCalculationAsColumnsCheckBox.IsEnabled = false;
                    }
                    break;
                }
            }

            if (pivot != null && current != null && current.Content != null)
            {
                int index;
                switch (current.Content.ToString())
                {
                case "Show Product Subtotals":

                    if (current.IsChecked == true)
                    {
                        if (pivot.PivotCalculations.Any(i => i.FieldName == "Product"))
                        {
                            pivot.ShowSubTotals = true;
                            count--;
                        }
                        if (pivot.GroupingBar.Filters.Any(i => i.Name == "Product"))
                        {
                            index =
                                pivot.GroupingBar.Filters.IndexOf(
                                    pivot.GroupingBar.Filters.FirstOrDefault(x => x.Name == "Product"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.GroupingBar.Filters[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                        index =
                            pivot.PivotRows.IndexOf(
                                pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "Product"));
                        if (index >= 0)
                        {
                            pivot.ShowSubTotals = true;
                            pivot.PivotRows[index].ShowSubTotal = true;
                            count--;
                        }
                        else
                        {
                            index =
                                pivot.PivotColumns.IndexOf(
                                    pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "Product"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.PivotColumns[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                    }
                    else
                    {
                        index =
                            pivot.PivotRows.IndexOf(
                                pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "Product"));
                        if (index >= 0)
                        {
                            pivot.PivotRows[index].ShowSubTotal = false;
                            count++;
                        }
                        else
                        {
                            index =
                                pivot.PivotColumns.IndexOf(
                                    pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "Product"));
                            if (index >= 0)
                            {
                                pivot.PivotColumns[index].ShowSubTotal = false;
                                count++;
                            }
                        }
                    }
                    pivot.InvalidateCells();

                    break;

                case "Show Country Subtotals":
                    if (current.IsChecked == true)
                    {
                        if (pivot.PivotCalculations.Any(i => i.FieldName == "Country"))
                        {
                            pivot.ShowSubTotals = true;
                            count--;
                        }
                        if (pivot.GroupingBar.Filters.Any(i => i.Name == "Country"))
                        {
                            index =
                                pivot.GroupingBar.Filters.IndexOf(
                                    pivot.GroupingBar.Filters.FirstOrDefault(x => x.Name == "Country"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.GroupingBar.Filters[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                        index =
                            pivot.PivotColumns.IndexOf(
                                pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "Country"));
                        if (index >= 0)
                        {
                            pivot.ShowSubTotals = true;
                            pivot.PivotColumns[index].ShowSubTotal = true;
                            count--;
                        }
                        else
                        {
                            index =
                                pivot.PivotRows.IndexOf(
                                    pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "Country"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.PivotRows[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                    }
                    else
                    {
                        index =
                            pivot.PivotColumns.IndexOf(
                                pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "Country"));
                        if (index >= 0)
                        {
                            pivot.PivotColumns[index].ShowSubTotal = false;
                            count++;
                        }
                        else
                        {
                            index =
                                pivot.PivotRows.IndexOf(
                                    pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "Country"));
                            if (index >= 0)
                            {
                                pivot.PivotRows[index].ShowSubTotal = false;
                                count++;
                            }
                        }
                    }
                    pivot.InvalidateCells();
                    break;

                case "Show Date Subtotals":
                    if (current.IsChecked == true)
                    {
                        if (pivot.PivotCalculations.Any(i => i.FieldName == "Date"))
                        {
                            pivot.ShowSubTotals = true;
                            count--;
                        }
                        if (pivot.GroupingBar.Filters.Any(i => i.Name == "Date"))
                        {
                            index =
                                pivot.GroupingBar.Filters.IndexOf(
                                    pivot.GroupingBar.Filters.FirstOrDefault(x => x.Name == "Date"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.GroupingBar.Filters[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                        index =
                            pivot.PivotRows.IndexOf(pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "Date"));
                        if (index >= 0)
                        {
                            pivot.ShowSubTotals = true;
                            pivot.PivotRows[index].ShowSubTotal = true;
                            count--;
                        }
                        else
                        {
                            index =
                                pivot.PivotColumns.IndexOf(
                                    pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "Date"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.PivotColumns[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                    }
                    else
                    {
                        index =
                            pivot.PivotRows.IndexOf(pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "Date"));
                        if (index >= 0)
                        {
                            pivot.PivotRows[index].ShowSubTotal = false;
                            count++;
                        }
                        else
                        {
                            index =
                                pivot.PivotColumns.IndexOf(
                                    pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "Date"));
                            if (index >= 0)
                            {
                                pivot.PivotColumns[index].ShowSubTotal = false;
                                count++;
                            }
                        }
                    }
                    pivot.InvalidateCells();
                    break;

                case "Show State Subtotals":
                    if (current.IsChecked == true)
                    {
                        if (pivot.PivotCalculations.Any(i => i.FieldName == "State"))
                        {
                            pivot.ShowSubTotals = true;
                            count--;
                        }
                        if (pivot.GroupingBar.Filters.Any(i => i.Name == "State"))
                        {
                            index =
                                pivot.GroupingBar.Filters.IndexOf(
                                    pivot.GroupingBar.Filters.FirstOrDefault(x => x.Name == "State"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.GroupingBar.Filters[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                        index =
                            pivot.PivotColumns.IndexOf(
                                pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "State"));
                        if (index >= 0)
                        {
                            pivot.ShowSubTotals = true;
                            pivot.PivotColumns[index].ShowSubTotal = true;
                            count--;
                        }
                        else
                        {
                            index =
                                pivot.PivotRows.IndexOf(
                                    pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "State"));
                            if (index >= 0)
                            {
                                pivot.ShowSubTotals = true;
                                pivot.PivotRows[index].ShowSubTotal = true;
                                count--;
                            }
                        }
                    }
                    else
                    {
                        index =
                            pivot.PivotColumns.IndexOf(
                                pivot.PivotColumns.FirstOrDefault(x => x.FieldMappingName == "State"));
                        if (index >= 0)
                        {
                            pivot.PivotColumns[index].ShowSubTotal = false;
                            count++;
                        }
                        else
                        {
                            index =
                                pivot.PivotRows.IndexOf(
                                    pivot.PivotRows.FirstOrDefault(x => x.FieldMappingName == "State"));
                            if (index >= 0)
                            {
                                pivot.PivotRows[index].ShowSubTotal = false;
                                count++;
                            }
                        }
                    }
                    pivot.InvalidateCells();

                    break;

                case "Show Row Subtotals":
                    if (current.IsChecked == true)
                    {
                        pivot.ShowRowSubTotals         = true;
                        showProductSubTotals.IsChecked = true;
                        showDateSubTotals.IsChecked    = true;
                        for (int i = 0; i < pivot.PivotRows.Count; i++)
                        {
                            pivot.PivotRows[i].ShowSubTotal = true;
                        }
                        count = 0;
                    }
                    else
                    {
                        pivot.ShowRowSubTotals         = false;
                        showProductSubTotals.IsChecked = false;
                        showDateSubTotals.IsChecked    = false;
                    }
                    break;

                case "Show Column Subtotals":
                    if (current.IsChecked == true)
                    {
                        pivot.ShowColumnSubTotals      = true;
                        showCountrySubTotals.IsChecked = true;
                        showStateSubTotals.IsChecked   = true;
                        for (int i = 0; i < pivot.PivotColumns.Count; i++)
                        {
                            pivot.PivotColumns[i].ShowSubTotal = true;
                        }
                        count = 0;
                    }
                    else
                    {
                        pivot.ShowColumnSubTotals      = false;
                        showCountrySubTotals.IsChecked = false;
                        showStateSubTotals.IsChecked   = false;
                    }
                    break;

                case "Show Subtotals":
                    if (current.IsChecked == true)
                    {
                        pivot.ShowSubTotals            = true;
                        showProductSubTotals.IsChecked = true;
                        showCountrySubTotals.IsChecked = true;
                        showDateSubTotals.IsChecked    = true;
                        showStateSubTotals.IsChecked   = true;
                        showRowSubTotals.IsChecked     = true;
                        showColumnSubTotals.IsChecked  = true;
                        for (int i = 0; i < pivot.PivotRows.Count; i++)
                        {
                            pivot.PivotRows[i].ShowSubTotal = true;
                        }
                        for (int i = 0; i < pivot.PivotColumns.Count; i++)
                        {
                            pivot.PivotColumns[i].ShowSubTotal = true;
                        }

                        count = 0;
                    }
                    else
                    {
                        pivot.ShowSubTotals            = false;
                        showProductSubTotals.IsChecked = false;
                        showCountrySubTotals.IsChecked = false;
                        showDateSubTotals.IsChecked    = false;
                        showStateSubTotals.IsChecked   = false;
                        showRowSubTotals.IsChecked     = false;
                        showColumnSubTotals.IsChecked  = false;
                        for (int i = 0; i < pivot.PivotRows.Count; i++)
                        {
                            pivot.PivotRows[i].ShowSubTotal = false;
                        }
                        for (int i = 0; i < pivot.PivotColumns.Count; i++)
                        {
                            pivot.PivotColumns[i].ShowSubTotal = false;
                        }

                        count = 4;
                    }
                    pivot.InvalidateCells();
                    break;

                case "Show Expander for Single Pivot":
                    pivot.ShowExpanderForSinglePivot = current.IsChecked == true;
                    pivot.InvalidateCells();
                    break;
                }
                if (count == 0)
                {
                    showAllSubTotals.IsChecked = true;
                }
                else if (count < 4)
                {
                    showAllSubTotals.IsChecked = null;
                }
                else if (count == 4)
                {
                    showAllSubTotals.IsChecked = false;
                }
            }
        }