-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
35 lines (34 loc) · 1.73 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Windows.Forms;
using DevExpress.Data.PivotGrid;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraPivotGrid;
namespace PivotGridControl_CustomCellEdit {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
// Creates new repository items.
RepositoryItemTextEdit riTextEdit = new RepositoryItemTextEdit();
RepositoryItemProgressBar riProgressBar = new RepositoryItemProgressBar();
private void Form1_Load(object sender, EventArgs e) {
this.salesPersonTableAdapter.Fill(this.nwindDataSet.SalesPerson);
// Initializes cell editors for this Pivot Grid control.
pivotGridControl1.RepositoryItems.AddRange(new RepositoryItem[] { riTextEdit, riProgressBar });
}
void pivotGridControl1_CustomCellEdit(object sender, PivotCustomCellEditEventArgs e) {
// Specifies a cell editor which is used in both display and edit modes.
if (e.DataField == fieldQuantityPercent & e.RowValueType == PivotGridValueType.Value)
e.RepositoryItem = riProgressBar;
}
void pivotGridControl1_CustomCellEditForEditing(object sender, PivotCustomCellEditEventArgs e) {
// Overrides the cell editor for the edit mode.
if (e.DataField == fieldQuantityPercent & e.RowValueType == PivotGridValueType.Value)
e.RepositoryItem = riTextEdit;
}
private void pivotGridControl1_CustomCellValue(object sender, PivotCellValueEventArgs e) {
if (e.DataField == fieldQuantityPercent)
e.Value = Math.Round(Convert.ToDecimal(e.Value) * 100, 2);
}
}
}