ClassRadPivotGrid
RadPivotGrid is a control which provides functionality similar to the functionality of PivotTables in MS Excel. It aggregates large chunks of data and displays them in a human readable way.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.PivotGrid.dll
Syntax:
[TelerikToolboxCategory("Data Controls")]
public class RadPivotGrid : RadControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider, IPrintable, IChartDataProvider
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadPivotGrid
Implements:
Inherited Members
Constructors
RadPivotGrid()
Initializes a new instance of the RadPivotGrid class with default settings. Creates an empty pivot grid control that can be configured to display aggregated data from various data sources.
Declaration
public RadPivotGrid()
Properties
AggregateDescriptions
A collection of PropertyAggregateDescription which describes how the values in the cells are calculated (aggregated).
Declaration
[Browsable(true)]
public AggregateDescriptionsCollection AggregateDescriptions { get; }
Property Value
AggregatesLevel
Gets or sets the depth of the Aggregates groups among the other groups when more than one aggregate is used.
Declaration
[Browsable(true)]
public int AggregatesLevel { get; set; }
Property Value
AggregatesPosition
Gets or sets the axis of the Aggregates groups when more than one aggregate is used.
Declaration
[Browsable(true)]
public PivotAxis AggregatesPosition { get; set; }
Property Value
AllowContextMenu
Gets or sets a value indicating whether the built-in context menu is enabled.
AllowDefaultScreenTips
Gets or sets a value indicating whether the built-in screen tips are enabled.
AllowFieldsDragDrop
Gets or sets a value indicating whether fields can be dragged and dropped between different areas of the pivot grid. When enabled, users can reorganize the pivot layout by moving fields between row, column, value and filter areas.
Declaration
[Browsable(true)]
public bool AllowFieldsDragDrop { get; set; }
Property Value
AllowGroupFiltering
Gets or sets a value indicating whether Group Filtering is enabled.
AllowHorizontalResize
Gets or sets a value indicating whether the user is able to resize columns.
AllowSelection
Gets or sets a value indicating whether the user is able to select cells.
AllowSorting
Gets or sets a value indicating whether the user is able to sort the group labels.
AllowVerticalResize
Gets or sets a value indicating whether the user is able to resize rows.
AutoExpandColumnHeaders
Gets or sets a value indicating whether the created column groups should be initially expanded.
AutoExpandRowHeaders
Gets or sets a value indicating whether the newly created row groups should be initially expanded.
ChartDataProvider
Gets or sets the chart data provider.
Declaration
[Browsable(true)]
public PivotGridChartDataProvider ChartDataProvider { get; set; }
Property Value
The chart data provider.
ColumnGrandTotalsPosition
Gets or sets the position of the GrandTotal column in the Columns axis.
Declaration
[Browsable(true)]
public TotalsPos ColumnGrandTotalsPosition { get; set; }
Property Value
ColumnGroupDescriptions
A collection of PropertyGroupDescriptionBase which is used for generating column groups.
Declaration
[Browsable(true)]
public ColumnGroupDescriptionCollection ColumnGroupDescriptions { get; }
Property Value
ColumnGroupsExpandBehavior
Gets or sets the behavior that will set the expand or collapse state for column IGroups.
Declaration
[Browsable(false)]
public IItemExpandBehavior<ExpandBehaviorParameters> ColumnGroupsExpandBehavior { get; set; }
Property Value
ColumnHeaderHeight
Gets or sets the height of the column headers area.
ColumnHeadersLayout
Gets or sets the layout type of the column headers.
Declaration
[Browsable(true)]
public PivotLayout ColumnHeadersLayout { get; set; }
Property Value
ColumnWidth
Gets or sets the default column width for all columns.
ColumnsSubTotalsPosition
Gets or sets the position of the SubTotal columns in the Columns axis.
Declaration
[Browsable(true)]
public TotalsPos ColumnsSubTotalsPosition { get; set; }
Property Value
DataMember
Gets or sets the name of the list or table in the data source for which RadPivotGrid is displaying aggregated data.
Declaration
[Browsable(true)]
public string DataMember { get; set; }
Property Value
DataProvider
Gets or sets the IDataProvider that populates the pivot grid with data.
Declaration
[Browsable(false)]
public IDataProvider DataProvider { get; set; }
Property Value
DataSource
Gets or sets the data source for which RadPivotGrid is displaying aggregated data.
DefaultSize
Gets the default size of the control.
DialogsFactory
Gets or sets the dialogs factory.
Declaration
[Browsable(false)]
public PivotGridDialogsFactory DialogsFactory { get; set; }
Property Value
PivotGridDialogsFactory
The dialogs factory.
EmptyValueString
Gets or sets the string that will appears on cells that do not have a value.
ErrorString
Gets or sets the string that will appears on cells for which an error has occured during calculation.
FilterAreaHeight
Gets or sets the height of the report filters area.
FilterDescriptions
A collection of PropertyFilterDescription which defines the fields that are available in the Report Filters area.
Declaration
[Browsable(true)]
public FilterDescriptionsCollection FilterDescriptions { get; }
Property Value
PivotGridElement
Gets the pivot grid element.
Declaration
[Browsable(false)]
public RadPivotGridElement PivotGridElement { get; }
Property Value
The pivot grid element.
PrintStyle
Gets or sets the PivotGridPrintStyle that is responsible for printing the pivot grid.
Declaration
[Browsable(true)]
public PivotGridPrintStyle PrintStyle { get; set; }
Property Value
RowGrandTotalsPosition
Gets or sets the position of the GrandTotal row in the Rows axis.
Declaration
[Browsable(true)]
public TotalsPos RowGrandTotalsPosition { get; set; }
Property Value
RowGroupDescriptions
A collection of PropertyGroupDescriptionBase which is used for generating row groups.
Declaration
[Browsable(true)]
public RowGroupDescriptionCollection RowGroupDescriptions { get; }
Property Value
RowGroupsExpandBehavior
Gets or sets the behavior that will set the expand or collapse state for row IGroups.
Declaration
[Browsable(false)]
public IItemExpandBehavior<ExpandBehaviorParameters> RowGroupsExpandBehavior { get; set; }
Property Value
RowHeadersLayout
Gets or sets the layout type of the row headers.
Declaration
[Browsable(true)]
public PivotLayout RowHeadersLayout { get; set; }
Property Value
RowHeight
Gets or sets the default row height for all rows.
RowsSubTotalsPosition
Gets or sets the position of the SubTotal rows in the Rows axis.
Declaration
[Browsable(true)]
public TotalsPos RowsSubTotalsPosition { get; set; }
Property Value
ShowFilterArea
Gets or sets a value indicating whether the Report Filters area should be displayed.
Declaration
[Browsable(true)]
public bool ShowFilterArea { get; set; }
Property Value
XmlSerializationInfo
Gets or sets the serialization information for RadPivotGrid used by SaveLayout and LoadLayout methods to persist and restore grid settings. By default or when set to null, the ComponentXmlSerializationInfo provided by GetDefaultXmlSerializationInfo() will be used.
Declaration
[Browsable(false)]
public ComponentXmlSerializationInfo XmlSerializationInfo { get; set; }
Property Value
Methods
BeginInit()
Signals the start of the control's initialization and suspends layout and data updates. Used during control creation and when loading the control state from a serialized form.
Declaration
public override void BeginInit()
Overrides
BeginUpdate()
Puts RadPivotGrid in update mode and suspends visual refreshing. Use this method before making multiple property changes to improve performance by preventing multiple layout updates. Must be paired with a subsequent call to EndUpdate() when finished making changes.
Declaration
public void BeginUpdate()
CreateChildItems(RadElement)
Creates the child elements for the RadPivotGrid control. Initializes the pivotGridElement and adds it to the parent's collection.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
parent
The parent element that will contain the created child elements.
Overrides
CreatePivotGridElement()
Creates the RadPivotGridElement which is the main visual element of the pivot grid control. Override this method to create a custom pivot grid element when inheriting from RadPivotGrid.
Declaration
protected virtual RadPivotGridElement CreatePivotGridElement()
Returns
A new instance of RadPivotGridElement that will be used to render the pivot grid.
CreateXmlSerializer(ComponentXmlSerializationInfo)
Creates the XML serializer used for saving and loading the pivot grid's layout. Override this method to provide custom serialization behavior when extending this control.
Declaration
protected virtual ComponentXmlSerializer CreateXmlSerializer(ComponentXmlSerializationInfo info)
Parameters
info
The serialization information that defines which properties to serialize.
Returns
A ComponentXmlSerializer instance that will handle the actual serialization.
EndInit()
Signals the end of the control's initialization and resumes layout and data updates. The control will be refreshed to reflect all changes made during initialization.
Declaration
public override void EndInit()
Overrides
EndUpdate()
Ends the update mode and refreshes the pivot grid's visual representation. Call this method after BeginUpdate() once you've finished making property changes to apply all pending updates at once.
Declaration
public void EndUpdate()
GetDefaultXmlSerializationInfo()
Gets the default serialization information for RadPivotGrid used by SaveLayout and LoadLayout methods to persist and restore grid settings to/from XML. This includes configuration of rows, columns, aggregates, filters, and appearance settings.
Declaration
protected virtual ComponentXmlSerializationInfo GetDefaultXmlSerializationInfo()
Returns
A ComponentXmlSerializationInfo instance configured with the default settings for RadPivotGrid serialization.
IsInputKey(Keys)
Determines whether the specified key is a regular input key or a special key that requires preprocessing.
LoadLayout(Stream)
Loads the RadPivotGrid's layout configuration from an XML stream. Restores group configurations, column widths, row heights, and other display settings from the provided stream.
Declaration
public virtual void LoadLayout(Stream stream)
Parameters
stream
The stream containing the saved layout information.
LoadLayout(XmlReader)
Loads the RadPivotGrid's layout configuration from an XML reader. Restores group configurations, column widths, row heights, and other display settings from the provided XML reader.
Declaration
public virtual void LoadLayout(XmlReader xmlReader)
Parameters
xmlReader
The XmlReader containing the saved layout information.
LoadLayout(string)
Loads the RadPivotGrid's layout configuration from an XML file. Restores group configurations, column widths, row heights, and other display settings from the specified file.
Declaration
public virtual void LoadLayout(string fileName)
Parameters
fileName
The path to the file containing the saved layout information.
OnKeyDown(KeyEventArgs)
Raises the KeyDown event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
e
A KeyEventArgs that contains the event data.
Overrides
OnLostFocus(EventArgs)
Raises the LostFocus event.
OnMouseDown(MouseEventArgs)
Raises the MouseDown event.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
Overrides
OnMouseMove(MouseEventArgs)
Raises the MouseMove event.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
Overrides
OnMouseUp(MouseEventArgs)
Raises the event.
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
e
The MouseEventArgs instance containing the event data.
Overrides
OnMouseWheel(MouseEventArgs)
Raises the MouseWheel event.
Declaration
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data.
Overrides
OnScreenTipNeeded(object, ScreenTipNeededEventArgs)
Called when the screen tip is needed.
Declaration
protected override void OnScreenTipNeeded(object sender, ScreenTipNeededEventArgs e)
Parameters
sender
The sender.
e
The ScreenTipNeededEventArgs instance containing the event data.
Overrides
Print()
Directly prints the RadPivotGrid to the default printer without showing any printer settings dialog. This is a convenience method that uses the current default printer with default settings.
Declaration
public virtual void Print()
Print(bool)
Prints the RadPivotGrid with an option to display the printer settings dialog first.
Declaration
public virtual void Print(bool showPrinterSettings)
Parameters
showPrinterSettings
When true, displays the printer settings dialog before printing; when false, prints directly using default settings.
Print(bool, RadPrintDocument)
Prints the RadPivotGrid using a specified print document and with an option to display the printer settings dialog.
Declaration
public virtual void Print(bool showPrinterSettings, RadPrintDocument document)
Parameters
showPrinterSettings
When true, displays the printer settings dialog before printing; when false, prints directly using default settings.
document
An instance of RadPrintDocument used to control the print process and settings.
PrintPreview()
Opens a print preview dialog that allows viewing and adjusting how the pivot grid will appear when printed. This method creates a new RadPrintDocument with default settings.
Declaration
public virtual void PrintPreview()
PrintPreview(RadPrintDocument)
Opens a print preview dialog that allows viewing and adjusting how the pivot grid will appear when printed. This overload uses a specified RadPrintDocument for more control over the printing process.
Declaration
public virtual void PrintPreview(RadPrintDocument document)
Parameters
document
An instance of RadPrintDocument used to control the print process and settings.
ReloadData()
Recalculates all the aggregated data and refreshes the visual representation of the pivot grid. Use this method when the underlying data source has changed and you need to update the pivot grid.
Declaration
public void ReloadData()
SaveLayout(Stream)
Saves the RadPivotGrid's current layout configuration to a stream in XML format. This includes group configurations, column widths, row heights, and other display settings. The stream remains open after the operation completes.
Declaration
public virtual void SaveLayout(Stream stream)
Parameters
stream
The stream where the layout information will be written.
SaveLayout(XmlWriter)
Saves the RadPivotGrid's current layout configuration to XML format. This includes properties like group configurations, column widths, row heights, and other display settings.
Declaration
public virtual void SaveLayout(XmlWriter xmlWriter)
Parameters
xmlWriter
The XmlWriter used to write the serialized layout data.
SaveLayout(string)
Saves the RadPivotGrid's current layout configuration to a file in XML format. This includes group configurations, column widths, row heights, and other display settings.
Declaration
public virtual void SaveLayout(string fileName)
Parameters
fileName
The path to the file where the layout information will be saved.
ShowFieldList()
Shows the Field Chooser dialog which allows users to select and organize fields in the pivot grid. Users can drag fields to different areas (row fields, column fields, data fields, or filter fields) to reorganize the pivot grid.
Declaration
public void ShowFieldList()
Events
AggregateDescriptorElementCreating
Fires when an aggregate descriptor element is being created. Allows for replacing it with a custom element.
Declaration
public event AggregateDescriptorElementCreatingEventHandler AggregateDescriptorElementCreating
Event Value
AggregatesPositionElementCreating
Fires when the aggregate position element is being created. Allows for replacing it with a custom element.
Declaration
public event AggregatesPositionElementCreatingEventHandler AggregatesPositionElementCreating
Event Value
CellCreating
Fires when a cell element is being created. Allows for replacing the default elements with custom ones.
Declaration
public event PivotCellCreatingEventHandler CellCreating
Event Value
CellFormatting
Fires when a cell element is updated. Allows for customizing the appearance of the cells.
Declaration
public event PivotCellEventHandler CellFormatting
Event Value
DataProviderChanged
Fires when the DataProvider property has changed.
Declaration
public event DataProviderChangedEventHandler DataProviderChanged
Event Value
FilterDescriptorElementCreating
Fires when a filter descriptor element is being created. Allows for replacing it with a custom element.
Declaration
public event FilterDescriptorElementCreatingEventHandler FilterDescriptorElementCreating
Event Value
GroupDescriptorElementCreating
Fires when a group descriptor element is being created. Allows for replacing it with a custom element.
Declaration
public event GroupDescriptorElementCreatingEventHandler GroupDescriptorElementCreating
Event Value
GroupElementCreating
Fires when a group element is being created. Allows for replacing the default group elements.
Declaration
public event PivotGroupElementCreatingEventHandler GroupElementCreating
Event Value
GroupElementFormatting
Fires when a group element is updated. Allows for customizing its appearance.
Declaration
public event PivotGroupElementEventHandler GroupElementFormatting
Event Value
GroupExpandedChanged
Fires when a group is expanded or collapsed.
Declaration
public event PivotGroupEventHandler GroupExpandedChanged
Event Value
PrintElementFormatting
Fires when a print element is being prepared for painting.
Declaration
public event PrintElementEventHandler PrintElementFormatting
Event Value
PrintElementPaint
Fires when the print element has been painted. Allows for adding custom painting.
Declaration
public event PrintElementPaintEventHandler PrintElementPaint
Event Value
RowCreating
Fires when a row element is being created. Allows for replacing the default elements with custom ones.
Declaration
public event PivotRowCreatingEventHandler RowCreating
Event Value
RowFormatting
Fires when a row element is updated.
Declaration
public event PivotRowEventHandler RowFormatting
Event Value
SelectionChanged
Fires when the selection in RadPivotGrid has changed.
UpdateCompleted
Fires when the data provider has finished building the data and the UI was updated.