Class PivotEditingManager
PivotEditingManager provides editing support for value cells in the PivotGrid control. You can enable this support by setting PivotGridControl.EnableValueEditing to true.
Inheritance
Namespace: Syncfusion.Windows.Controls.PivotGrid
Assembly: Syncfusion.PivotAnalysis.WPF.dll
Syntax
public class PivotEditingManager : Object
Constructors
PivotEditingManager(PivotGridControl)
Handles the event while editing the Pivot values.
Declaration
public PivotEditingManager(PivotGridControl pivotGrid)
Parameters
Type | Name | Description |
---|---|---|
PivotGridControl | pivotGrid | The PivotGrid control. |
Properties
AllowEditingOfTotalCells
Gets or sets whether the user can edit total cells.
Declaration
public bool AllowEditingOfTotalCells { get; set; }
Property Value
Type |
---|
System.Boolean |
EditedCell
Gets or sets the edited cell row/column index.
Declaration
public RowColumnIndex EditedCell { get; set; }
Property Value
Type |
---|
RowColumnIndex |
HideExpanders
Gets or sets whether the expanders are visible.
Declaration
public bool HideExpanders { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
add_PivotValueEdited(PivotValueEditedEvent)
Declaration
public void add_PivotValueEdited(PivotValueEditedEvent value)
Parameters
Type | Name | Description |
---|---|---|
PivotValueEditedEvent | value |
ChangeValue(Object, Object, Int32, Int32, PivotCellInfo)
Override this method to affect the change represented in the method arguments.
Declaration
protected virtual void ChangeValue(object oldValue, object newValue, int row1, int col1, PivotCellInfo pi)
Parameters
Type | Name | Description |
---|---|---|
System.Object | oldValue | The old value from the cell that was edited. |
System.Object | newValue | The new value from the cell that was edited. |
System.Int32 | row1 | Points to the row index of cell being adjusted. This cell may be different from the cell that was edited. |
System.Int32 | col1 | Points to the column index of cell being adjusted. This cell may be different from the cell that was edited. |
PivotCellInfo | pi | The PivotCellInfo for the cell being adjusted. |
Remarks
The default implementation treats the adjustment as if the underlying calculation were a summation. This means the oldValue is subtracted from the cell being adjusted, and the new value is added. The adjustment is made by setting pi.Value and pi.FormattedText.
Examples
The following code shows the default implementation.
protected virtual void ChangeValue(object oldValue, object newValue, int row1, int col1, PivotCellInfo pi)
{
double dNew = 0d;
double dOld = 0d;
double dExisting = 0d;
if (oldValue == null)
oldValue = 0;
if (newValue == null)
newValue = 0;
if (pi.Value == null)
pi.Value = 0;
bool bNew = double.TryParse(newValue.ToString(), out dNew);
bool bOld = double.TryParse(oldValue.ToString(), out dOld);
bool bExisting = double.TryParse(pi.Value.ToString(), out dExisting);
if (bExisting)
{
dExisting += (bNew ? dNew : 0) - (bOld ? dOld : 0);
}
else
{
dExisting = (bNew ? dNew : 0) - (bOld ? dOld : 0);
}
pi.Value = dExisting;
pi.FormattedText = string.Format("{0:" + pivotGrid.PivotEngine.PivotCalculations[col1 % pivotGrid.PivotEngine.PivotCalculations.Count].Format + "}", pi.Value);
}
Dispose()
Clears Undo/Redo lists and un-subscribes the events.
Declaration
public void Dispose()
GetRawItemsFor(Int32, Int32)
Gets a list of raw data items that go into computing the value, displayed in the given row and column.
Declaration
public List<object> GetRawItemsFor(int row, int col)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row index. |
System.Int32 | col | The column index. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Object> | The list of data items associated with the given cell. |
Remarks
If the row and column point to any cell other than a value cell, an list containing zero items is returned. If you are using a DataView as the underlying data source, the returned list contain DataRowView objects. If you are using an IList<object, then the return list will contain T objects."/>
GetRowColumnPivotValuesAt(Int32, Int32, out String)
Gets a list of row and column Pivot values at a specified index.
Declaration
public List<IComparable> GetRowColumnPivotValuesAt(int row, int column, out string calcFieldName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row index. |
System.Int32 | column | The column index. |
System.String | calcFieldName | The name of the calculated field at the given row and column. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.IComparable> | Returns a list of row and column Pivot values. |
Remarks
The returned list is an ordered list of the Pivot values that determine the staring with the row Pivot values followed by the column Pivot values. There is a one to one correspondence between the number of items in PivotRows and then PivotColumns to this returned ordered list.
Redo()
Redoes the previously undone editing change.
Declaration
public void Redo()
Remarks
If a cell is actively being edited when this method is called, then the editing of that cell is cancelled. If there is no actively editing cell when this method is called, then the last undone editing action is restored.
remove_PivotValueEdited(PivotValueEditedEvent)
Declaration
public void remove_PivotValueEdited(PivotValueEditedEvent value)
Parameters
Type | Name | Description |
---|---|---|
PivotValueEditedEvent | value |
SetCellValue(Int32, Int32, Object)
Sets the value of any specific cell dynamically from code behind. It will update the total cells automatically when the corresponding cell value is changing.
Declaration
public void SetCellValue(int row, int col, object newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row index. |
System.Int32 | col | The column index. |
System.Object | newValue | The new value. |
Undo()
Reverts the last editing change.
Declaration
public void Undo()
Remarks
If a cell is actively being edited when this method is called, then the editing of that cell is cancelled. If there is no actively editing cell when this method is called, then the last changed cell is reverted to its previous value.
Events
PivotValueEdited
Event raised as the user completes editing of a cell.
Declaration
public event PivotValueEditedEvent PivotValueEdited
Event Type
Type |
---|
PivotValueEditedEvent |