[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Get Started With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Expand]Data Editing and Validation
   [Expand]Filter and Search
   [Collapse]Focus and Selection Handling
     Focusing Cells
     Moving Row Focus
     Using Navigators
     Multiple Row and Cell Selection
     Multiple Row Selection via Built-In Check Column and Selection Binding
    Format Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
    Hit Information
    Popup Menus
   [Expand]Save and Restore Layout
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Moving Row Focus

This topic provides information on the methods that enable you to move row focus. These methods move focus by a specified number of rows forward or backward. If you need to focus particular rows, please refer to the Focusing Cells topic that provides general information about determining the focused cell and moving focus between Views, rows and columns.

Expanded Moving Row Focus

Generally, you will use the methods listed in the table below to move row focus. All these methods are declared by the ColumnView class and thus supported by all View types currently available in XtraGrid.

Method Description
ColumnView.MoveFirst Moves focus to the first visible row within the View.
ColumnView.MoveNext Moves focus to the row following the one currently focused.
ColumnView.MovePrev Moves focus to the row preceding the one currently focused.
ColumnView.MoveNextPage Moves focus forward by the number of rows displayed within the View.
ColumnView.MovePrevPage Moves focus backward by the number of rows displayed within the View.
ColumnView.MoveLast Moves focus to the last row within the View.
ColumnView.MoveLastVisible Moves focus to the last visible row (the last row that is not hidden within a collapsed group).
ColumnView.MoveBy Moves focus by the specified number of rows.

Note that all the methods above, except for the ColumnView.MoveLast method, move focus among visible rows only. This implies that calling these methods will not expand collapsed group rows when using Grid Views. For information on custom navigation through group rows together with their children, please refer to the Working with Groups in Code topic. Note also that the methods in the table above don't allow you to move focus to child or parent Views. For instance, calling the ColumnView.MoveNext method when an expanded master row is focused will focus the next master row within the same View. To learn how to navigate through master and detail rows, please refer to the Master-Detail Relationships and Working with Master-Detail Relationships in Code topics.

One more important member that supports row focus movement is the ColumnView.FocusedRowHandle property. This identifies the currently focused row within a View. For instance, you can increment or decrement the ColumnView.FocusedRowHandle property to move focus to the next or the previous row within a View.

The table below lists additional members that may be useful for you when moving row focus. These members enable you to determine whether the currently focused row is the first or last within a View and thus stop focus movements when such rows are reached. If you implement your own controls for row focus movement, you can use the members below to determine when such controls should be disabled.

Member Description
ColumnView.IsFirstRow Returns true if the currently focused row is the first within a View.
ColumnView.IsLastRow Returns true if the currently focused row is the last data row within a View.
ColumnView.IsLastVisibleRow Returns true if the currently focused row is the last visible within a View.
BaseView.RowCount Returns the total number of visible rows within a View.
BaseView.DataRowCount Returns the number of data rows within a View. Compare this value to the ColumnView.FocusedRowHandle property to determine whether or not the currently focused row is the last row within a View.

Expanded See Also

Is this topic helpful?​​​​​​​