windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnview-0ac4b13b.md
Fires when the focused row’s handle changes.
Namespace : DevExpress.XtraGrid.Views.Base
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[DXCategory("Property Changed")]
public event FocusedRowChangedEventHandler FocusedRowChanged
<DXCategory("Property Changed")>
Public Event FocusedRowChanged As FocusedRowChangedEventHandler
The FocusedRowChanged event's data class is FocusedRowChangedEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| FocusedRowHandle | Gets the handle of the currently focused row. |
| PrevFocusedRowHandle | Gets the handle of the previously focused row. |
The FocusedRowChanged event is raised when the ColumnView.FocusedRowHandle property value changes (for example, a user moves row focus, applies sorting/filtering, etc.).
See the following help topic for additional information: Moving Row Focus.
Tip
The view raises the FocusedRowObjectChanged event when another row object is focused.
Note
When focus moves between Master-Detail Views, the FocusedRowChanged event is not raised. The GridControl.FocusedViewChanged event is raised instead.
This example expands a collapsed group row and vice versa when this row receives focus.
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Base;
private void gridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) {
GridView view = sender as GridView;
if (view == null) return;
if (view.IsGroupRow(e.FocusedRowHandle)) {
bool expanded = view.GetRowExpanded(e.FocusedRowHandle);
view.SetRowExpanded(e.FocusedRowHandle, !expanded);
}
}
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Base
Private Sub GridView1_FocusedRowChanged(ByVal sender As System.Object, _
ByVal e As FocusedRowChangedEventArgs) Handles GridView1.FocusedRowChanged
Dim view As GridView = sender
If view Is Nothing Then
Return
End If
If view.IsGroupRow(e.FocusedRowHandle) Then
Dim expanded As Boolean = view.GetRowExpanded(e.FocusedRowHandle)
view.SetRowExpanded(e.FocusedRowHandle, Not expanded)
End If
End Sub
See Also