Class MasterGridViewTemplate
Represents the master template for RadGridView that provides the core functionality for data display, hierarchical relationships, selection management, and event synchronization across the entire grid structure.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.GridView.dll
Syntax
public class MasterGridViewTemplate : GridViewTemplate, IDataItemSource, IHierarchicalRow, INotifyPropertyChangingEx, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IGridViewEventListener
Constructors
MasterGridViewTemplate()
Initializes a new instance of the MasterGridViewTemplate class.
Declaration
public MasterGridViewTemplate()
Properties
AddNewBoundRowBeforeEdit
Gets or sets a value indicating whether a new bound row should be added to the data source before entering edit mode.
Declaration
public bool AddNewBoundRowBeforeEdit { get; set; }
Property Value
System.Boolean
|
AutoGenerateHierarchy
Gets or sets a value indicating whether the RadGridView will automatically generate hierarchical relationships from the data source structure when data binding is performed.
Declaration
public bool AutoGenerateHierarchy { get; set; }
Property Value
System.Boolean
|
CanChangePage
Gets a value that indicates whether the IPagedCollectionView.PageIndex value is allowed to change.
Declaration
public virtual bool CanChangePage { get; }
Property Value
System.Boolean
true if the IPagedCollectionView.PageIndex value is allowed to change; otherwise, false. |
ClipboardCopyMode
Gets or sets a value that determines whether users can copy cell text values to the clipboard and whether row and column header text is included in the copy operation.
Declaration
public GridViewClipboardCopyMode ClipboardCopyMode { get; set; }
Property Value
GridViewClipboardCopyMode
|
ClipboardCutMode
Gets or sets a value that determines whether users can cut cell text values to the clipboard and whether row and column header text is included in the cut operation.
Declaration
public GridViewClipboardCutMode ClipboardCutMode { get; set; }
Property Value
GridViewClipboardCutMode
|
ClipboardPasteMode
Gets or sets a value that determines whether users can paste clipboard content into the RadGridView control and how the paste operation is handled.
Declaration
public GridViewClipboardPasteMode ClipboardPasteMode { get; set; }
Property Value
GridViewClipboardPasteMode
|
CurrentRow
Gets or sets the currently active row in the grid. Setting this property triggers current row changed events and updates the current column to match the new row's template if applicable.
Declaration
public GridViewRowInfo CurrentRow { get; set; }
Property Value
GridViewRowInfo
|
CurrentView
Gets or sets the currently active GridViewInfo that represents the view containing the current row and associated template information.
Declaration
public GridViewInfo CurrentView { get; set; }
Property Value
GridViewInfo
|
EnablePaging
Gets or sets a value indicating whether data pagination is enabled for the current data view, allowing data to be displayed in pages.
Declaration
public bool EnablePaging { get; set; }
Property Value
System.Boolean
|
EventDispatcher
Gets the EventDispatcher instance responsible for managing and dispatching events within the master template. Creates a new instance if one does not already exist.
Declaration
public override EventDispatcher EventDispatcher { get; }
Property Value
EventDispatcher
|
Overrides
GridReadOnly
This property is not relevant for this class.
Declaration
public bool GridReadOnly { get; set; }
Property Value
System.Boolean
|
HierarchyDataProvider
Gets or sets the hierarchy data provider for the master template. Only GridViewSelfReferenceDataProvider and GridViewSelfReferenceLoadOnDemandDataProvider types are supported for master templates.
Declaration
public override GridViewHierarchyDataProvider HierarchyDataProvider { get; set; }
Property Value
GridViewHierarchyDataProvider
|
Overrides
IsPageChanging
Gets a value that indicates whether a page index change is in process.
Declaration
public virtual bool IsPageChanging { get; }
Property Value
System.Boolean
true if the page index is changing; otherwise, false. |
MasterTemplate
Gets the root master template. For MasterGridViewTemplate instances, this property returns itself as it represents the top-level template in the hierarchy.
Declaration
public override MasterGridViewTemplate MasterTemplate { get; }
Property Value
MasterGridViewTemplate
|
Overrides
MultiSelect
Gets or sets a value indicating whether multiple cells, rows, or columns can be selected simultaneously in the RadGridView. When false, only single selection is allowed.
Declaration
public bool MultiSelect { get; set; }
Property Value
System.Boolean
|
Owner
Gets the RadGridView control that owns this master template instance.
Declaration
public RadGridView Owner { get; }
Property Value
RadGridView
|
PageIndex
Gets the zero-based index of the current page.
Declaration
public virtual int PageIndex { get; }
Property Value
System.Int32
The zero-based index of the current page. |
PageSize
Gets or sets the number of items to display on a page.
Declaration
public virtual int PageSize { get; set; }
Property Value
System.Int32
The number of items to display on a page. |
PagingBeforeGrouping
Gets or sets a value indicating whether paging is performed before grouping or vice versa.
Declaration
public virtual bool PagingBeforeGrouping { get; set; }
Property Value
System.Boolean
|
Relations
Gets the collection of GridViewRelation instances that define the hierarchical structure and parent-child relationships between templates in the grid.
Declaration
public GridViewRelationCollection Relations { get; }
Property Value
GridViewRelationCollection
|
SelectedCells
Gets the collection of GridViewCellInfo instances that represent the cells currently selected by the user across all templates in the grid.
Declaration
public GridViewSelectedCellsCollection SelectedCells { get; }
Property Value
GridViewSelectedCellsCollection
|
SelectedRows
Gets the collection of GridViewRowInfo instances that represent the rows currently selected by the user across all templates in the grid.
Declaration
public GridViewSelectedRowsCollection SelectedRows { get; }
Property Value
GridViewSelectedRowsCollection
|
SelectionMode
Gets or sets the selection mode that determines how cells, rows, or columns can be selected in the RadGridView.
Declaration
public GridViewSelectionMode SelectionMode { get; set; }
Property Value
GridViewSelectionMode
|
SelfReferenceExpanderColumn
Gets or sets the GridViewColumn that will contain the self-reference expander items for hierarchical data display in self-referencing scenarios.
Declaration
public GridViewColumn SelfReferenceExpanderColumn { get; set; }
Property Value
GridViewColumn
|
SynchronizationService
Gets the GridViewSynchronizationService instance that coordinates event dispatch and synchronization across all templates and views within the RadGridView hierarchy.
Declaration
public GridViewSynchronizationService SynchronizationService { get; }
Property Value
GridViewSynchronizationService
|
ThrowExceptionOnDataOperationInVirtualMode
This property is not relevant for this class.
Declaration
public bool ThrowExceptionOnDataOperationInVirtualMode { get; set; }
Property Value
System.Boolean
|
TotalPages
Gets the total number of pages.
Declaration
public virtual int TotalPages { get; }
Property Value
System.Int32
|
VirtualMode
Gets or sets a value indicating whether the grid operates in virtual mode, where data management operations such as sorting, filtering, and grouping are handled by the application rather than the grid control.
Declaration
public bool VirtualMode { get; set; }
Property Value
System.Boolean
|
Methods
AnalyzeQueueCore(List<GridViewEvent>)
Declaration
protected override bool AnalyzeQueueCore(List<GridViewEvent> events)
Parameters
System.Collections.Generic.List<GridViewEvent>
events
|
Returns
System.Boolean
|
Overrides
BeginCellCopy()
Begins the cell copy.
Declaration
public void BeginCellCopy()
BeginRowCopy()
Begins the row copy.
Declaration
public void BeginRowCopy()
BeginUpdate()
Suspends event dispatching and begins a batch update operation to improve performance when making multiple changes to the grid.
Declaration
public override void BeginUpdate()
Overrides
ClearSelectedRowsOrCells()
Clears all selected rows and cells from their respective collections in an efficient batch operation.
Declaration
protected virtual void ClearSelectedRowsOrCells()
Copy()
Copies the formatted values of the currently selected cells to the clipboard without removing them from the grid.
Declaration
public virtual void Copy()
CreateBindingContext()
Creates the binding context for the master template. The master template inherits its binding context from the RadGridView control.
Declaration
protected override BindingContext CreateBindingContext()
Returns
System.Windows.Forms.BindingContext
Returns null as the master template uses the binding context from its parent RadGridView control. |
Overrides
CreateListSource()
Creates and returns a new GridViewListSource instance specifically configured for the master template.
Declaration
protected override GridViewListSource CreateListSource()
Returns
GridViewListSource
A new GridViewListSource instance associated with this master template. |
Overrides
Cut()
Moves the currently selected cells or rows to the clipboard, removing their values from the grid.
Declaration
public virtual void Cut()
Dispose(Boolean)
Releases the unmanaged resources used by the System.ComponentModel.Component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
System.Boolean
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
EndCellCopy()
Ends the cell copy.
Declaration
public void EndCellCopy()
EndInit()
Completes the initialization of the master template and triggers hierarchy generation if no child templates exist.
Declaration
public override void EndInit()
Overrides
EndRowCopy()
Ends the row copy.
Declaration
public void EndRowCopy()
EndUpdate(Boolean, DataViewChangedEventArgs)
Resumes event dispatching and ends the batch update operation, triggering hierarchy changed events across all templates in the grid.
Declaration
public override void EndUpdate(bool notify, DataViewChangedEventArgs e)
Parameters
System.Boolean
notify
Indicates whether to notify listeners of the changes. |
DataViewChangedEventArgs
e
The data view changed event arguments containing information about the changes. |
Overrides
GetClipboardContent()
Retrieves the formatted values that represent the contents of the selected cells for copying to the clipboard without actually placing them on the clipboard.
Declaration
public virtual DataObject GetClipboardContent()
Returns
System.Windows.Forms.DataObject
A System.Windows.Forms.DataObject containing the formatted cell values in multiple clipboard formats. |
GetClipboardData()
Retrieves and parses clipboard data in multiple formats (HTML, Text, CSV) and returns it as a structured collection of rows and columns.
Declaration
protected virtual List<List<string>> GetClipboardData()
Returns
System.Collections.Generic.List<System.Collections.Generic.List<System.String>>
A list of lists representing rows and columns of clipboard data. |
GetEventListenerPirotiy()
Gets the event listener priority for the master template, which is set to highest priority to ensure it processes events first.
Declaration
protected override EventListenerPriority GetEventListenerPirotiy()
Returns
EventListenerPriority
The Highest priority level. |
Overrides
GetEventProcessMode()
Gets the event processing mode for the master template, enabling all phases of event processing including pre-processing, processing, post-processing, and queue analysis.
Declaration
protected override GridEventProcessMode GetEventProcessMode()
Returns
GridEventProcessMode
A combination of GridEventProcessMode flags indicating comprehensive event processing. |
Overrides
GetRowsToPasteIn(Int32)
Gets the collection of existing rows where clipboard data should be pasted, starting from the current row position.
Declaration
protected virtual List<GridViewRowInfo> GetRowsToPasteIn(int numberOfRowsToGet)
Parameters
System.Int32
numberOfRowsToGet
The number of rows to retrieve for pasting. |
Returns
System.Collections.Generic.List<GridViewRowInfo>
A list of GridViewRowInfo objects representing the target rows for pasting. |
MoveToFirstPage()
Sets the first page as the current page.
Declaration
public virtual bool MoveToFirstPage()
Returns
System.Boolean
true if the operation was successful; otherwise, false. |
MoveToLastPage()
Sets the last page as the current page.
Declaration
public virtual bool MoveToLastPage()
Returns
System.Boolean
true if the operation was successful; otherwise, false. |
MoveToNextPage()
Moves to the page after the current page.
Declaration
public virtual bool MoveToNextPage()
Returns
System.Boolean
true if the operation was successful; otherwise, false. |
MoveToPage(Int32)
Requests a page move to the page at the specified zero-based index.
Declaration
public virtual bool MoveToPage(int pageIndex)
Parameters
System.Int32
pageIndex
The zero-based index of the page to move to. |
Returns
System.Boolean
true if the operation was successful; otherwise, false. |
MoveToPreviousPage()
Moves to the page before the current page.
Declaration
public virtual bool MoveToPreviousPage()
Returns
System.Boolean
true if the operation was successful; otherwise, false. |
OnNotifyPropertyChanged(PropertyChangedEventArgs)
Handles property change notifications, triggering hierarchy generation when DataSource or DataMember properties change.
Declaration
protected override void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters
System.ComponentModel.PropertyChangedEventArgs
e
The System.ComponentModel.PropertyChangedEventArgs containing information about the changed property. |
Overrides
OnPageChanged(Object, EventArgs)
Called when the page is changed.
Declaration
protected virtual void OnPageChanged(object sender, EventArgs e)
Parameters
System.Object
sender
The sender. |
System.EventArgs
e
The System.EventArgs instance containing the event data. |
OnPageChanging(Object, PageChangingEventArgs)
Called when the page is changing.
Declaration
protected virtual void OnPageChanging(object sender, PageChangingEventArgs e)
Parameters
System.Object
sender
The sender. |
PageChangingEventArgs
e
The PageChangingEventArgs instance containing the event data. |
OnViewChanged(Object, DataViewChangedEventArgs)
Handles view change events and performs additional logic such as paging adjustments when the view is reset.
Declaration
protected override void OnViewChanged(object sender, DataViewChangedEventArgs e)
Parameters
System.Object
sender
The source of the event. |
DataViewChangedEventArgs
e
The DataViewChangedEventArgs containing information about the view change. |
Overrides
Paste()
Pastes the contents from the clipboard into the grid starting at the current cell position, creating new rows if necessary when pasting multiple rows.
Declaration
public virtual void Paste()
PasteDataToNewRow(List<String>)
Pastes the data to new row.
Declaration
protected virtual void PasteDataToNewRow(List<string> rowData)
Parameters
System.Collections.Generic.List<System.String>
rowData
The row data. |
PasteDataToRow(List<String>, GridViewRowInfo)
Pastes a row of clipboard data into an existing grid row, performing data type conversion and validation as needed.
Declaration
protected virtual void PasteDataToRow(List<string> rowData, GridViewRowInfo row)
Parameters
System.Collections.Generic.List<System.String>
rowData
The list of string values representing the clipboard row data. |
GridViewRowInfo
row
The target GridViewRowInfo where the data will be pasted. |
PostProcessEventCore(GridViewEvent)
Post-processes grid events, handling row disposal and view change cleanup operations after the main event processing is complete.
Declaration
protected override GridViewEventResult PostProcessEventCore(GridViewEvent eventData)
Parameters
GridViewEvent
eventData
The GridViewEvent containing event information. |
Returns
GridViewEventResult
A GridViewEventResult indicating the post-processing outcome, or null if no special handling is required. |
Overrides
PreProcessEventCore(GridViewEvent)
Pre-processes grid events, particularly current row change events, to determine if the event should continue processing or be canceled.
Declaration
protected override GridViewEventResult PreProcessEventCore(GridViewEvent eventData)
Parameters
GridViewEvent
eventData
The GridViewEvent containing event information. |
Returns
GridViewEventResult
A GridViewEventResult indicating whether to continue event processing or cancel it. |
Overrides
ProcessEventCore(GridViewEvent)
Processes core grid events including current row changes, template data source initialization, and column collection changes.
Declaration
protected override GridViewEventResult ProcessEventCore(GridViewEvent eventData)
Parameters
GridViewEvent
eventData
The GridViewEvent containing event information. |
Returns
GridViewEventResult
A GridViewEventResult indicating the processing outcome, or null to continue with default processing. |
Overrides
Reset()
Resets the master template to its default state by clearing all child templates, relations, columns, and resetting the data source and AutoGenerateHierarchy property.
Declaration
public void Reset()
ResetCurrentRow()
Resets the current row.
Declaration
protected override void ResetCurrentRow()
Overrides
SetPosition(GridViewRowInfo, GridViewColumn, Boolean)
Sets the current position in the grid by changing the active row and column, with optional validation of the row change.
Declaration
protected bool SetPosition(GridViewRowInfo row, GridViewColumn column, bool validateRowChange)
Parameters
GridViewRowInfo
row
The GridViewRowInfo to set as the current row. |
GridViewColumn
column
The GridViewColumn to set as the current column. |
System.Boolean
validateRowChange
Indicates whether to validate the row change operation. |
Returns
System.Boolean
True if the position was successfully changed; otherwise, false. |
SetPositionCore(GridViewRowInfo, GridViewColumn, GridViewRowInfo, GridViewColumn, Boolean)
Performs the core logic for setting the current position, including event handling, current row/column changes, and UI updates.
Declaration
protected virtual bool SetPositionCore(GridViewRowInfo newRow, GridViewColumn newColumn, GridViewRowInfo oldRow, GridViewColumn oldColumn, bool validateRowChange)
Parameters
GridViewRowInfo
newRow
The new GridViewRowInfo to set as current. |
GridViewColumn
newColumn
The new GridViewColumn to set as current. |
GridViewRowInfo
oldRow
The previous current row. |
GridViewColumn
oldColumn
The previous current column. |
System.Boolean
validateRowChange
Indicates whether to validate the row change operation. |
Returns
System.Boolean
True if the position change was successful; otherwise, false. |
UnwireEvents()
Unsubscribes from internal events to prevent memory leaks when the master template is being disposed.
Declaration
protected override void UnwireEvents()
Overrides
WireEvents()
Subscribes to internal events required for the master template functionality, including paging events from the data view.
Declaration
protected override void WireEvents()