ClassRadVirtualGrid
Represents a complex virtual grid control that allows displaying and editing tabular data from any kind of data source, providing advanced features such as sorting, filtering, hierarchical data display, and virtual scrolling for optimal performance with large datasets.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.GridView.dll
Syntax:
[TelerikToolboxCategory("Data Controls")]
public class RadVirtualGrid : RadControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadVirtualGrid
Implements:
Inherited Members
Constructors
RadVirtualGrid()
Declaration
public RadVirtualGrid()
Fields
FilterRowIndex
Represents the constant value for the filter row index.
HeaderRowIndex
Represents the constant value for the header row index.
IndentCellIndex
Represents the constant value for the indent cell index.
NewRowIndex
Represents the constant value for the new row index.
Properties
ActiveEditor
Gets the currently active cell editor when the grid is in edit mode, providing access to the input control being used for editing.
AllowAddNewRow
Gets or sets a value indicating whether the add new row for inserting new records is visible at the bottom of the grid.
AllowCellContextMenu
Gets or sets a value indicating whether right-clicking on a data cell displays the default data cell context menu with cut, copy, paste, and other options.
AllowColumnHeaderContextMenu
Gets or sets a value indicating whether right-clicking on a header cell displays the default header cell context menu with sorting and filtering options.
Declaration
public bool AllowColumnHeaderContextMenu { get; set; }
Property Value
AllowColumnResize
Gets or sets a value indicating whether users can resize columns through the grid user interface by dragging the column borders.
AllowCopy
Gets or sets a value indicating whether the Copy option in the context menu and the Ctrl+C keyboard shortcut are available to users for copying cell content.
AllowCut
Gets or sets a value indicating whether the Cut option in the context menu and the Ctrl+X keyboard shortcut are available to users for cutting cell content.
AllowDelete
Gets or sets a value indicating whether users can delete rows using the Delete key or through the context menu.
AllowEdit
Gets or sets a value indicating whether users can edit the values in data cells by double-clicking or pressing F2.
AllowFiltering
Gets or sets a value indicating whether the filter row for column-based filtering is visible below the header row.
AllowMultiColumnSorting
Gets or sets a value indicating whether users can sort by multiple columns simultaneously to create complex sorting scenarios.
AllowPaste
Gets or sets a value indicating whether the Paste option in the context menu and the Ctrl+V keyboard shortcut are available to users for pasting cell content.
AllowRowResize
Gets or sets a value indicating whether users can resize rows through the grid user interface by dragging the row borders.
AllowSorting
Gets or sets a value indicating whether users can sort columns by clicking the column header or through the header context menu.
AutoSizeColumnsMode
Gets or sets a value indicating how column widths are automatically determined, such as fitting to content, filling available space, or using fixed widths.
Declaration
public VirtualGridAutoSizeColumnsMode AutoSizeColumnsMode { get; set; }
Property Value
BeginEditMode
Gets or sets the method for entering edit mode, determining how users can start editing a cell (keystroke, F2, double-click, etc.).
Declaration
public RadVirtualGridBeginEditMode BeginEditMode { get; set; }
Property Value
ColumnCount
Gets or sets the total number of columns to be displayed in the grid, which determines the grid's horizontal structure.
CurrentCell
Gets or sets the currently active cell in the grid, which is the cell that has focus and can be edited.
Declaration
[Browsable(false)]
public VirtualGridCellInfo CurrentCell { get; set; }
Property Value
DefaultSize
Gets the default size of the control when no explicit size is specified.
EnableAlternatingRowColor
Gets or sets a value indicating whether even and odd rows display with different background colors to improve data readability.
Declaration
public bool EnableAlternatingRowColor { get; set; }
Property Value
EnableHotTracking
Gets or sets a value indicating whether there is a visual indication, such as highlighting, for the row currently under the mouse cursor.
EnablePaging
Gets or sets a value indicating whether data is presented in chunks or pages to the user, which improves performance with large datasets.
EnterKeyMode
Gets or sets the behavior of the Enter key when pressed while in edit mode, such as moving to the next cell or ending the edit operation.
Declaration
public RadVirtualGridEnterKeyMode EnterKeyMode { get; set; }
Property Value
FilterDescriptors
Gets the collection of filter descriptors currently applied to the grid, which define the filtering criteria for data display.
Declaration
[Browsable(false)]
public FilterDescriptorCollection FilterDescriptors { get; }
Property Value
IsInEditMode
Gets a value indicating whether the grid is currently in edit mode with an active cell editor.
MasterViewInfo
Gets the main VirtualGridViewInfo instance that contains the primary data view configuration and settings for the grid.
Declaration
public VirtualGridViewInfo MasterViewInfo { get; }
Property Value
MultiSelect
Gets or sets a value indicating whether multiple cells, rows, or columns can be selected simultaneously using Ctrl+Click or Shift+Click combinations.
PageIndex
Gets or sets the zero-based index of the page currently displayed in the grid when paging is enabled.
PageSize
Gets or sets the number of rows displayed per page when paging is enabled, which determines how many records are visible at once.
RowCount
Gets or sets the total number of data rows to be displayed in the grid, which is used for virtual scrolling and paging calculations.
Selection
Gets a VirtualGridSelection object that provides a comprehensive API for programmatically manipulating cell and row selection in the grid.
Declaration
[Browsable(false)]
public VirtualGridSelection Selection { get; }
Property Value
SelectionMode
Gets or sets a value indicating how cells are selected in the grid, either individual cells, entire rows, or entire columns.
Declaration
public VirtualGridSelectionMode SelectionMode { get; set; }
Property Value
ShowHeaderRow
Gets or sets a value indicating whether the header row containing column headers is visible in the grid.
ShowNoDataText
Gets or sets a value indicating whether a "No data to display" message is shown in the grid when no data is loaded or all data is filtered out.
SortDescriptors
Gets the collection of sort descriptors currently applied to the grid, which define the sorting criteria for data display.
Declaration
[Browsable(false)]
public SortDescriptorCollection SortDescriptors { get; }
Property Value
StandardTab
Gets or sets a value indicating whether the TAB key moves focus to the next control in the tab order rather than navigating to the next cell within the grid.
TableElement
Gets an instance of VirtualGridTableElement that contains and manages all the row and column visual elements in the grid.
Declaration
public VirtualGridTableElement TableElement { get; }
Property Value
TotalPages
Gets the total number of pages available when paging is enabled, calculated based on the total row count and page size.
UseScrollbarsInHierarchy
Gets or sets a value indicating whether child views in hierarchical data display have fixed size or dynamically adjust based on the number of rows they contain.
Declaration
public bool UseScrollbarsInHierarchy { get; set; }
Property Value
VirtualGridElement
Gets the instance of RadVirtualGridElement that represents the main element in the element tree and encapsulates the core functionality of RadVirtualGrid.
Declaration
public RadVirtualGridElement VirtualGridElement { get; }
Property Value
XmlSerializationInfo
Gets or sets the serialization information for RadVirtualGrid used by Save/Load layout methods to persist grid settings to and from XML format. When set to null, the default serialization info from GetDefaultXmlSerializationInfo() is used.
Declaration
[Browsable(false)]
public ComponentXmlSerializationInfo XmlSerializationInfo { get; set; }
Property Value
Methods
BeginEdit()
Initiates the editing process for the currently selected cell, making it available for user input.
Declaration
public void BeginEdit()
BeginUpdate()
Suspends layout updates for the virtual grid to improve performance during bulk operations and prevent unnecessary redraws.
Declaration
public void BeginUpdate()
BestFitColumns()
Automatically adjusts the width of all columns in the master view to fit their content, expanding or shrinking columns based on the space required by the text in the cells.
Declaration
public void BestFitColumns()
BestFitColumns(VirtualGridViewInfo)
Automatically adjusts the width of all columns in the specified view to fit their content, expanding or shrinking columns based on the space required by the text in the cells.
Declaration
public void BestFitColumns(VirtualGridViewInfo viewInfo)
Parameters
viewInfo
The VirtualGridViewInfo containing the columns to resize.
CancelEdit()
Cancels the editing process without committing any changes, reverting the cell value to its original state.
Declaration
public bool CancelEdit()
Returns
True if the operation is successful and edit mode is exited; false if the operation fails or if the grid was not in edit mode.
CreateChildItems(RadElement)
Creates and initializes the child elements of the virtual grid control by adding the main grid element to the parent element.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
parent
The parent RadElement that will contain the child elements.
Overrides
CreateElement()
Creates and returns a new instance of RadVirtualGridElement that serves as the main element for this control.
Declaration
protected virtual RadVirtualGridElement CreateElement()
Returns
A new RadVirtualGridElement instance.
EndEdit()
Ends the editing process and attempts to commit any changes made to the cell value, applying validation if necessary.
Declaration
public bool EndEdit()
Returns
True if the operation is successful and changes are committed; false if the operation fails due to validation errors or if the grid was not in edit mode.
EndUpdate()
Resumes layout updates for the virtual grid and triggers any pending layout operations that were deferred during the update suspension.
Declaration
public void EndUpdate()
GetDefaultXmlSerializationInfo()
Gets the default serialization information for RadVirtualGrid used by Save/Load layout methods to persist grid settings to and from XML format.
Declaration
public virtual ComponentXmlSerializationInfo GetDefaultXmlSerializationInfo()
Returns
A ComponentXmlSerializationInfo object containing the default serialization metadata for grid layout persistence.
IsInputKey(Keys)
Determines whether the specified key combination represents an input key that should be processed by the grid for navigation and editing operations.
LoadLayout(Stream)
Loads RadVirtualGrid layout configuration including properties and sub-objects from an XML stream using the serialization information from XmlSerializationInfo.
LoadLayout(XmlReader)
Loads RadVirtualGrid layout configuration including properties and sub-objects from XML data using the specified XML reader and the serialization information from XmlSerializationInfo.
LoadLayout(string)
Loads RadVirtualGrid layout configuration including properties and sub-objects from an XML file using the specified file path and the serialization information from XmlSerializationInfo.
Declaration
public virtual void LoadLayout(string fileName)
Parameters
fileName
The full path of the file to load the grid layout from.
OnKeyDown(KeyEventArgs)
Raises the KeyDown event and handles keyboard input for cell navigation, editing operations, and special key combinations.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
e
A KeyEventArgs that contains the event data including key code and modifier state.
Overrides
OnKeyPress(KeyPressEventArgs)
Raises the KeyPress event and handles character input for cell editing and data entry operations.
Declaration
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
e
A KeyPressEventArgs that contains the event data including the character pressed.
Overrides
OnKeyUp(KeyEventArgs)
Raises the KeyUp event and handles keyboard input release, managing navigation between cells when editing with text box editors.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
e
A KeyEventArgs that contains the event data including key code and modifier state.
Overrides
OnLayout(LayoutEventArgs)
Raises the Layout event and synchronizes the grid rows to ensure proper visual layout.
Declaration
protected override void OnLayout(LayoutEventArgs e)
Parameters
e
A LayoutEventArgs that contains the event data.
Overrides
OnLayoutLoaded(object, LayoutLoadedEventArgs)
Raises the LayoutLoaded event when the grid layout has been successfully loaded from XML data.
Declaration
protected void OnLayoutLoaded(object sender, LayoutLoadedEventArgs e)
Parameters
sender
The source of the event, typically the RadVirtualGrid instance.
e
A LayoutLoadedEventArgs that contains the event data.
OnMouseClick(MouseEventArgs)
Raises the MouseClick event and handles single-click interactions with cells, triggering the CellClick event for valid cell clicks.
Declaration
protected override void OnMouseClick(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data including button, location, and click information.
Overrides
OnMouseDoubleClick(MouseEventArgs)
Raises the MouseDoubleClick event and handles double-click interactions with cells, potentially triggering cell-specific actions.
Declaration
protected override void OnMouseDoubleClick(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data including button, location, and click information.
Overrides
OnMouseDown(MouseEventArgs)
Raises the MouseDown event and handles mouse down interactions with the grid, recording the mouse down location for click detection.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data including button, location, and click information.
Overrides
OnMouseMove(MouseEventArgs)
Raises the MouseMove event and handles mouse movement over the grid for tracking, selection, and resize operations.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data including button state and location information.
Overrides
OnMouseUp(MouseEventArgs)
Raises the MouseUp event and handles mouse button release interactions with the grid.
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data including button, location, and click information.
Overrides
OnMouseWheel(MouseEventArgs)
Raises the MouseWheel event and handles mouse wheel scrolling for vertical navigation through the grid.
Declaration
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
e
A MouseEventArgs that contains the event data including wheel delta and location information.
Overrides
OnValidating(CancelEventArgs)
Raises the Validating event and performs validation of the current cell and row if the grid is in edit mode.
Declaration
protected override void OnValidating(CancelEventArgs e)
Parameters
e
A CancelEventArgs that contains the event data and allows cancellation of the validation.
Overrides
ProcessDialogKey(Keys)
Processes dialog keys such as Tab and Escape, handling cell navigation and edit mode operations according to the grid's input behavior settings.
SaveLayout(Stream)
Saves the current RadVirtualGrid layout configuration including properties and sub-objects to XML format using the specified stream and the serialization information from XmlSerializationInfo. The stream is left open after the operation.
SaveLayout(XmlWriter)
Saves the current RadVirtualGrid layout configuration including properties and sub-objects to XML format using the specified XML writer and the serialization information from XmlSerializationInfo.
SaveLayout(string)
Saves the current RadVirtualGrid layout configuration including properties and sub-objects to an XML file using the specified file path and the serialization information from XmlSerializationInfo.
Declaration
public virtual void SaveLayout(string fileName)
Parameters
fileName
The full path of the file to save the grid layout to.
SelectAll()
Selects all visible cells in the grid according to the current selection mode and multi-select settings.
Declaration
public void SelectAll()
SelectCell(int, int)
Selects the cell at the specified row and column indices in the grid master view and clears any previous selection.
SelectCell(int, int, VirtualGridViewInfo)
Selects the cell at the specified row and column indices in the specified view and clears any previous selection.
Declaration
public void SelectCell(int row, int column, VirtualGridViewInfo viewInfo)
Parameters
row
The zero-based row index of the cell to select.
column
The zero-based column index of the cell to select.
viewInfo
The VirtualGridViewInfo that contains the target cell.
Events
CellClick
Occurs when a cell is clicked with the mouse, providing information about the clicked cell and mouse event details.
Declaration
public event VirtualGridCellElementEventHandler CellClick
Event Value
CellDoubleClick
Occurs when a cell is double-clicked with the mouse, typically triggering edit mode or other cell-specific actions.
CellEditorInitialized
Occurs when the editor for a cell has been initialized and is ready for customization or configuration.
Declaration
public event VirtualGridCellEditorInitializedEventHandler CellEditorInitialized
Event Value
CellFormatting
Occurs when a cell element is created or updated and needs custom formatting or styling applied.
Declaration
public event VirtualGridCellElementEventHandler CellFormatting
Event Value
CellMouseMove
Occurs when the mouse cursor is moved over a cell, providing continuous feedback about mouse position relative to grid cells.
Declaration
public event VirtualGridCellElementMouseEventHandler CellMouseMove
Event Value
CellPaint
Occurs after a cell has been painted by the system, allowing custom drawing operations on top of the cell content.
Declaration
public event VirtualGridCellPaintEventHandler CellPaint
Event Value
CellValidating
Occurs before a cell value is validated, providing an opportunity to perform custom validation logic and cancel invalid changes.
Declaration
public event VirtualGridCellValidatingEventHandler CellValidating
Event Value
CellValueNeeded
Occurs when a cell is displayed and its content needs to be populated, allowing data binding in virtual mode.
Declaration
public event VirtualGridCellValueNeededEventHandler CellValueNeeded
Event Value
CellValuePushed
Occurs when a cell value has been edited and needs to be stored back to the data source in virtual mode.
Declaration
public event VirtualGridCellValuePushedEventHandler CellValuePushed
Event Value
ColumnWidthChanged
Occurs after the width of a column has changed, indicating that the column has been successfully resized.
Declaration
public event VirtualGridColumnEventHandler ColumnWidthChanged
Event Value
ColumnWidthChanging
Occurs before the width of a column changes, providing an opportunity to validate or cancel the resize operation.
Declaration
public event VirtualGridColumnWidthChangingEventHandler ColumnWidthChanging
Event Value
ContextMenuOpening
Occurs when the context menu is about to be opened, allowing customization of menu items or cancellation of the menu display.
Declaration
public event VirtualGridContextMenuOpeningEventHandler ContextMenuOpening
Event Value
Copying
Occurs when cell content is being copied to the clipboard, allowing modification of the copy operation or the content being copied.
Declaration
public event VirtualGridClipboardEventHandler Copying
Event Value
CreateCellElement
Occurs when a new cell element needs to be created, allowing customization of the cell element type or properties.
Declaration
public event VirtualGridCreateCellEventHandler CreateCellElement
Event Value
CreateRowElement
Occurs when a new row element needs to be created, allowing customization of the row element type or properties.
Declaration
public event VirtualGridCreateRowEventHandler CreateRowElement
Event Value
CurrentCellChanged
Occurs after the current cell has changed to a different cell, indicating that navigation has completed.
CurrentCellChanging
Occurs before the current cell changes to a different cell, providing an opportunity to cancel the navigation.
Declaration
public event VirtualGridCellInfoCancelEventHandler CurrentCellChanging
Event Value
EditorRequired
Occurs when an editor is required for a cell, allowing custom editor selection or configuration based on cell content or type.
Declaration
public event VirtualGridEditorRequiredEventHandler EditorRequired
Event Value
FilterChanged
Occurs when the filter descriptors collection changes, indicating that the filtering criteria have been modified.
Declaration
public event VirtualGridEventHandler FilterChanged
Event Value
LayoutLoaded
Occurs when the grid layout has been successfully loaded from XML, allowing post-load processing and configuration.
Declaration
[Browsable(true)]
public event LayoutLoadedEventHandler LayoutLoaded
Event Value
PageChanged
Occurs after the current page index has changed when paging is enabled, indicating that a different page is now displayed.
Declaration
public event VirtualGridEventHandler PageChanged
Event Value
PageChanging
Occurs before the current page index changes when paging is enabled, allowing cancellation of the page navigation.
Declaration
public event VirtualGridPageChangingEventHandler PageChanging
Event Value
Pasting
Occurs when content is about to be pasted from the clipboard into cells, allowing modification of the paste operation or the content being pasted.
Declaration
public event VirtualGridClipboardEventHandler Pasting
Event Value
QueryHasChildRows
Occurs when the grid needs to determine whether a row has child rows in hierarchical data scenarios, allowing dynamic hierarchy detection.
Declaration
public event VirtualGridQueryHasChildRowsEventHandler QueryHasChildRows
Event Value
RowCollapsed
Occurs after a hierarchical row has been successfully collapsed to hide its child rows.
Declaration
public event VirtualGridRowExpandedEventHandler RowCollapsed
Event Value
RowCollapsing
Occurs before a hierarchical row is collapsed to hide its child rows, allowing cancellation of the operation.
Declaration
public event VirtualGridRowExpandingEventHandler RowCollapsing
Event Value
RowExpanded
Occurs after a hierarchical row has been successfully expanded to show its child rows.
Declaration
public event VirtualGridRowExpandedEventHandler RowExpanded
Event Value
RowExpanding
Occurs before a hierarchical row is expanded to show its child rows, allowing cancellation of the operation.
Declaration
public event VirtualGridRowExpandingEventHandler RowExpanding
Event Value
RowFormatting
Occurs when a row element is created or updated and needs custom formatting or styling applied.
Declaration
public event VirtualGridRowElementEventHandler RowFormatting
Event Value
RowHeightChanged
Occurs after the height of a row has changed, indicating that the row has been successfully resized.
Declaration
public event VirtualGridRowEventHandler RowHeightChanged
Event Value
RowHeightChanging
Occurs before the height of a row changes, providing an opportunity to validate or cancel the resize operation.
Declaration
public event VirtualGridRowHeightChangingEventHandler RowHeightChanging
Event Value
RowPaint
Occurs after a row has been painted by the system, allowing custom drawing operations on top of the entire row.
Declaration
public event VirtualGridRowPaintEventHandler RowPaint
Event Value
RowValidated
Occurs after a row has been successfully validated, indicating that all validation rules have passed.
Declaration
public event VirtualGridRowEventHandler RowValidated
Event Value
RowValidating
Occurs before a row is validated, providing an opportunity to perform custom validation logic across multiple cells in the row.
Declaration
public event VirtualGridRowValidatingEventHandler RowValidating
Event Value
SelectionChanged
Occurs after the selection has changed in the grid, indicating that different cells or rows are now selected.
SelectionChanging
Occurs before the selection changes in the grid, providing an opportunity to validate or cancel the selection change.
Declaration
public event VirtualGridSelectionChangingEventHandler SelectionChanging
Event Value
SortChanged
Occurs when the sort descriptors collection changes, indicating that the sorting criteria have been modified.
Declaration
public event VirtualGridEventHandler SortChanged
Event Value
UserAddedRow
Occurs when a user successfully adds a new row to the grid through the new row interface.
Declaration
public event VirtualGridNewRowEventHandler UserAddedRow
Event Value
UserDeletedRow
Occurs when a user successfully deletes one or more rows from the grid.
Declaration
public event VirtualGridRowsEventHandler UserDeletedRow
Event Value
ValueChanged
Occurs after the value of a cell has been successfully changed and committed.
ValueChanging
Occurs before the value of a cell is changed, providing an opportunity to validate or modify the new value.
Declaration
public event ValueChangingEventHandler ValueChanging
Event Value
ViewInfoPropertyChanged
Occurs when a property of any view info object changes, providing notification of configuration or state changes in the grid views.
Declaration
public event VirtualGridViewInfoPropertyChangedEventHandler ViewInfoPropertyChanged
Event Value