GridControl.ViewRegistered Event
Fires when a new detail clone is created.
Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v19.1.dll
Declaration
Event Data
The ViewRegistered event's data class is ViewOperationEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
View | Gets the currently processed View. |
Remarks
Detail clones are not stored in memory permanently. They are created and destroyed dynamically. When expanding a master row, a detail clone is created automatically to represent the detail data that becomes visible. If a master row has several details, other detail clones are created only when switching to them (making them visible). When collapsing a master row, all associated details are automatically destroyed.
When a detail clone is created, the grid control adds it to the GridControl.Views collection and raises the ViewRegistered
event. The new detail View can be accessed via the event’s ViewOperationEventArgs.View parameter.
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid;
private void gridControl1_ViewRegistered(object sender, DevExpress.XtraGrid.ViewOperationEventArgs e) {
GridView view = (GridView)e.View;
foreach (GridColumn col in view.Columns) {
if (col.FieldName == "Discount")
col.Caption = "Percent";
}
}
Please refer to the Master-Detail Relationships topic for details.
The ViewRegistered
event may also fire for the Main View (GridControl.MainView). This is the case if you subscribe to the event before the Main View has been set.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ViewRegistered event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.