DashboardViewer PivotDashboardItem PivotGridControl拖动异常

时间:2017-08-05 08:05:56

标签: c# winforms devexpress dashboard devexpress-windows-ui

我想简要解释一下我的情况, 我使用DashboardViwer项目,并将xml加载到由DashboardDesigner创建和保存的onload上。

然后,我填写DashboardObjectDataSource并将其添加到仪表板数据源以将其设置为项目。

最后,我在仪表板查看器中为PivotGridControl打开了一些属性和activere customizationform。

我根据我的设计正确地看到了报告结果,该设计是由仪表板设计师创建的。

但是,当我想要更改字段顺序或地点时,我会得到这种例外情况;

Object Referance

   position: DevExpress.XtraPivotGrid.Data.PivotFieldCellValueItem.GetTextCore()
   position: DevExpress.XtraPivotGrid.Data.PivotFieldValueItem.GetCustomText(Boolean calculateIsCustomDisplayText)
   position: DevExpress.XtraPivotGrid.Data.PivotFieldValueItem.CalculateText()
   position: DevExpress.XtraPivotGrid.Data.PivotFieldValueItem.get_Text()
   position: DevExpress.XtraPivotGrid.Data.PivotFieldValueItem.get_DisplayText()
   position: DevExpress.XtraPivotGrid.ViewInfo.PivotFieldsAreaCellViewInfo.get_DisplayText()
   position: DevExpress.XtraPivotGrid.ViewInfo.PivotFieldsAreaCellViewInfoBase.CreateHeaderInfoArgs(GraphicsCache graphicsCache)
   position: DevExpress.XtraPivotGrid.ViewInfo.PivotFieldsAreaCellViewInfoBase.InternalPaint(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfo.Paint(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfoCollection.Paint(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfo.PaintChildren(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfo.Paint(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfoCollection.Paint(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfo.PaintChildren(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfo.Paint(ViewInfoPaintArgs e)
   position: DevExpress.XtraPivotGrid.ViewInfo.BaseViewInfoControl.OnPaint(PaintEventArgs e)
   position: DevExpress.XtraPivotGrid.PivotGridControl.OnPaint(PaintEventArgs e)
   position: System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   position: System.Windows.Forms.Control.WmPaint(Message& m)
   position: System.Windows.Forms.Control.WndProc(Message& m)
   position: DevExpress.XtraPivotGrid.PivotGridControl.WndProc(Message& m)
   position: System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   position: System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   position: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

仪表板查看器项目数据源

[C#]

lSales = oSales.GetReport(filter); // fill list and set default values if it is null
dashboardViewerCreation.Dashboard.DataSources.Clear();
oDashboardObjectDataSource = new DashboardObjectDataSource(dashTitle, lSales);
dashboardViewerCreation.Dashboard.DataSources.Add(oDashboardObjectDataSource);

//Control each item and set data source
foreach (DashboardItem dashboardItem in dashboardViewerCreation.Dashboard.Items)
{
    if (dashboardItem.GetType() == typeof(PivotDashboardItem))
    {
        ((PivotDashboardItem)dashboardItem).DataSource = oDashboardObjectDataSource;
    }

}

dashboardViewerCreation.ReloadData(true);
dashboardViewerCreation.Refresh();

Dashboard Viever Item events

[C#]

private void dashboardViewerCreation_DashboardItemControlCreated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e)
    {
        if (e.PivotGridControl != null)
        {
            e.PivotGridControl.OptionsCustomization.AllowPrefilter = false;
            e.PivotGridControl.OptionsCustomization.AllowDrag = true;
            e.PivotGridControl.OptionsCustomization.AllowEdit = false;
            e.PivotGridControl.OptionsCustomization.AllowExpand = true;
            e.PivotGridControl.OptionsCustomization.AllowExpandOnDoubleClick = true;
            e.PivotGridControl.OptionsCustomization.AllowFilter = false;

            e.PivotGridControl.OptionsCustomization.AllowCustomizationForm = true;
            e.PivotGridControl.OptionsCustomization.AllowDragInCustomizationForm = true;

            e.PivotGridControl.OptionsBehavior.CopyToClipboardWithFieldValues = true;
            e.PivotGridControl.OptionsBehavior.ApplyBestFitOnFieldDragging = true;
            e.PivotGridControl.OptionsBehavior.HorizontalScrolling = PivotGridScrolling.Control;


            e.PivotGridControl.OptionsMenu.EnableFieldValueMenu = false;
            e.PivotGridControl.OptionsMenu.EnableFormatRulesMenu = false;

            e.PivotGridControl.OptionsView.ShowDataHeaders = true;
            e.PivotGridControl.OptionsView.ShowRowHeaders = true;
            e.PivotGridControl.OptionsView.ShowColumnHeaders = true;
            e.PivotGridControl.OptionsView.ShowFilterHeaders = true;
            e.PivotGridControl.OptionsView.ShowFilterSeparatorBar = true;
            e.PivotGridControl.OptionsView.ShowRowGrandTotals = true;
            e.PivotGridControl.OptionsView.ShowColumnTotals = true;

            e.PivotGridControl.OptionsCustomization.CustomizationFormLayout = CustomizationFormLayout.StackedDefault;
            e.PivotGridControl.OptionsCustomization.CustomizationFormStyle = CustomizationFormStyle.Excel2007;

            e.PivotGridControl.ShowingCustomizationForm += PivotGridControlOnShowingCustomizationForm;

        }
    }


private void PivotGridControlOnShowingCustomizationForm(object sender, CustomizationFormShowingEventArgs customizationFormShowingEventArgs)
    {
        customizationFormShowingEventArgs.ParentControl = splitContainerControl1.Panel1;
        customizationFormShowingEventArgs.CustomizationForm.Dock = DockStyle.Fill;
    }

1 个答案:

答案 0 :(得分:0)

  

Sergi(DevExpress支持);

     

在当前版本中,Dashboard Pivot Grid Item不支持   自定义表单功能。因此,如果您显示它   手动使用内部透视网格控件的API,自定义   表单可能无法正常工作,或者会在您的表单中引发异常   情况下。

     

目前,可以在Pivot中重新排序维度和度量   使用仪表板设计器的网格项。如果这种方法不符合   您的要求,请您更好地描述您的情景   详情?我们期待着您的回复。

  

John(DevExpress支持);

     

DashboardViewer控件仅用于显示仪表板。那是   为什么会这样   没有简单的方法来使用PivotGrid控件的自定义   DashboardViewer中的功能。要自定义仪表板   要求的方式,您需要使用DashboardDesigner控件。