Back to Devexpress

VGridControlBase.FocusedRowChanged Event

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrolbase-8914e625.md

latest3.4 KB
Original Source

VGridControlBase.FocusedRowChanged Event

Fires in response to row focus moving.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

Declaration

csharp
public event FocusedRowChangedEventHandler FocusedRowChanged
vb
Public Event FocusedRowChanged As FocusedRowChangedEventHandler

Event Data

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

PropertyDescription
OldRowGets the previously focused row.
RowGets the processed row. Inherited from RowEventArgs.

Remarks

The FocusedRowChanged event is raised when an end-user moves focus from one row to another or in response to changing the VGridControlBase.FocusedRow property in code.

This event parameter’s FocusedRowChangedEventArgs.OldRow and RowEventArgs.Row properties allow the previously and currently focused row to be determined, respectively.

For more information, see Focus and Scroll Rows.

Example

The following sample code handles the VGridControlBase.FocusedRowChanged event to show an image within the focused row header.

csharp
using DevExpress.XtraVerticalGrid.Events;

private void vGridControl1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) {
   if (e.OldRow == null){
      e.Row.Properties.ImageIndex = 0;
   }
   else {
      e.Row.Properties.ImageIndex = 0;
      e.OldRow.Properties.ImageIndex = -1;
   }
}
vb
Imports DevExpress.XtraVerticalGrid.Events

Private Sub VGridControl1_FocusedRowChanged(ByVal sender As Object, _
ByVal e As FocusedRowChangedEventArgs) Handles VGridControl1.FocusedRowChanged
   If e.OldRow Is Nothing Then
      e.Row.Properties.ImageIndex = 0
   Else
      e.Row.Properties.ImageIndex = 0
      e.OldRow.Properties.ImageIndex = -1
   End If
End Sub

See Also

FocusedRow

VGridControlBase Class

VGridControlBase Members

DevExpress.XtraVerticalGrid Namespace