Skip to main content

VGridControlBase.FocusedRecordChanged Event

Fires in response to record focus changing.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

Declaration

public event IndexChangedEventHandler FocusedRecordChanged

Event Data

The FocusedRecordChanged event's data class is IndexChangedEventArgs. The following properties provide information specific to this event:

Property Description
NewIndex Gets the index of the currently focused element.
OldIndex Gets the index of the previously focused element.

Remarks

The FocusedRecordChanged event is raised when an end-user moves focus from one record to another or after the VGridControlBase.FocusedRecord property’s value has been changed in code. This can occur in the cases listed below:

  • focus moves from cell to cell if the previously and currently focused cells belong to different records;
  • a record is focused after no record was focused;
  • the focused record has been deleted.

Example

The following sample code handles the VGridControlBase.FocusedRecordChanged event to obtain the currently and previously focused records in order to display the record selection sequence and the number of total records in the status bar sections.

Note: you need to place a StatusBar control on a Form.

The image below shows the result:

CurrentRecordChanged - event

using DevExpress.XtraVerticalGrid.Events;

private void vGridControl1_FocusedRecordChanged(object sender, IndexChangedEventArgs e) {
   statusBarPanel1.Text = "Current record: " + (e.NewIndex + 1).ToString();
   statusBarPanel2.Text = "Previously focused record: " + (e.OldIndex + 1).ToString();
   statusBarPanel3.Text = "Record count: " + vGridControl1.RecordCount.ToString();
}
See Also