Back to Devexpress

DXWIN0003: Pattern View Access

windowsforms-403882-build-an-application-security-considerations-code-diagnostics-win-003-message.md

latest1.3 KB
Original Source

DXWIN0003: Pattern View Access

  • Feb 18, 2023

Severity: Warning

When you set up Master-Detail sources in Data Grid, you select a View that should display details. However, this View (“pattern View”) does not exist at runtime. Instead, Data Grid creates copies of this pattern View (“clone Views”) and uses these copies to display detail data.

Since pattern Views do not display any data at runtime, it is incorrect to access these Views in attempts to obtain and modify cell values. Instead, get a copy (clone) of a required View. If you are handling an event, a real clone View is stored in the sender property.

See this article for more information: Patterns and Clones.

Invalid Code

csharp
private void GridView_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
   var value = this.gridView1.GetRowCellValue(e.RowHandle, e.Column);            
}

Valid Code

csharp
private void GridView_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e) {
   GridView view = sender as GridView;
   var value = view.GetRowCellValue(e.RowHandle, e.Column);  
}