Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ColumnView.FocusedRowChanged Event

Fires when the focused row’s handle changes.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.2.dll

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

#Declaration

[DXCategory("Property Changed")]
public event FocusedRowChangedEventHandler FocusedRowChanged

#Event Data

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.

#Remarks

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.

#Example

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);
     }
}
See Also