public void ProcessAction(DevExpress.XtraPivotGrid.PivotCellEventArgs e) { PivotGridListEditor listEditor = ((DevExpress.ExpressApp.ListView)View).Editor as PivotGridListEditor; int columnIndex = e.ColumnIndex; int rowIndex = e.RowIndex; PivotDrillDownDataSource drillDown = listEditor.PivotGridControl.CreateDrillDownDataSource(columnIndex, rowIndex); List <object> keysToShow = new List <object>(); for (int i = 0; i < drillDown.RowCount; i++) { object obj = drillDown[i][0]; if (obj != null) { keysToShow.Add(ObjectSpace.GetKeyValue(obj)); } } if (keysToShow.Count > 0) { string viewId = Application.GetListViewId(View.ObjectTypeInfo.Type); CollectionSourceBase collectionSource = Application.CreateCollectionSource(Application.CreateObjectSpace(), View.ObjectTypeInfo.Type, viewId); collectionSource.Criteria["SelectedObjects"] = new InOperator(ObjectSpace.GetKeyPropertyName(View.ObjectTypeInfo.Type), keysToShow); DevExpress.ExpressApp.ListView listView = Application.CreateListView(viewId, collectionSource, true); ShowViewParameters svp = new ShowViewParameters(listView); svp.TargetWindow = TargetWindow.NewModalWindow; //svp.Context = TemplateContext.View; Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(Frame, null)); } }
void pivotGridControl_CellDoubleClick(object sender, DevExpress.XtraPivotGrid.PivotCellEventArgs e) { // TODO: move to Win Forms int columnIndex = e.ColumnIndex; int rowIndex = e.RowIndex; // add custom columns var columns = new List <string>(); foreach (PivotGridFieldBase field in pivotGridControl1.Fields) { columns.Add(field.FieldName); } // print selected fields foreach (PivotGridField field in pivotGridControl1.Fields) { // print Field Name and Value // TODO: ignore fields if there is a field in a lower hierarchy var pivotValue = e.GetFieldValue(field); if (pivotValue != null) { Debug.Print(string.Format("{0} = {1}", field.FieldName, pivotValue)); } } }
private void gvPromotionAnalysis_CellDoubleClick(object sender, DevExpress.XtraPivotGrid.PivotCellEventArgs e) { Form form = new Form(); form.Text = "Records"; // Place a DataGrid control on the form. DataGrid grid = new DataGrid(); grid.Parent = form; grid.Dock = DockStyle.Fill; // Get the recrd set associated with the current cell and bind it to the grid. grid.DataSource = e.CreateDrillDownDataSource(); form.Bounds = new Rectangle(100, 100, 500, 400); // Display the form. form.ShowDialog(); form.Dispose(); }
private void button1_Click(object sender, EventArgs e) { DataTable tbl = new DataTable(); if (pivotGridControl1.Cells.RowCount == 0) { return; } List <PivotGridField> rowFields = pivotGridControl1.GetFieldsByArea(PivotArea.RowArea); foreach (PivotGridField rowField in rowFields) { tbl.Columns.Add(rowField.ToString()); } for (int i = 0; i < pivotGridControl1.Cells.ColumnCount; i++) { tbl.Columns.Add(GetColumnFieldValueText(pivotGridControl1, pivotGridControl1.Cells.GetCellInfo(i, 0))); } for (int rowIndex = 0; rowIndex < pivotGridControl1.Cells.RowCount; rowIndex++) { DataRow row = tbl.NewRow(); DevExpress.XtraPivotGrid.PivotCellEventArgs cellInfo = pivotGridControl1.Cells.GetCellInfo(0, rowIndex); foreach (PivotGridField rowField in rowFields) { row[rowField.AreaIndex] = cellInfo.GetFieldValue(rowField); } for (int columnIndex = 0; columnIndex < pivotGridControl1.Cells.ColumnCount; columnIndex++) { row[columnIndex + rowFields.Count] = pivotGridControl1.Cells.GetCellInfo(columnIndex, rowIndex).Value; } tbl.Rows.Add(row); } dataGridView1.DataSource = tbl; }
protected virtual void OnPivotGridControlCellDoubleClick(object sender, DevExpress.XtraPivotGrid.PivotCellEventArgs e) { ProcessAction(e); }
private void pivotGridControl1_CellClick(object sender, DevExpress.XtraPivotGrid.PivotCellEventArgs e) { TransferData(currentChartDataSourceType); }