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