DataViewBase.FocusedRowHandle Property

Gets or sets the focused row’s handle. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v21.2.Core.dll


public int FocusedRowHandle { get; set; }

Property Value

Type Description

An integer value that specifies the focused row’s handle.


The focused row is not displayed if the DataViewBase.NavigationStyle property is set to GridViewNavigationStyle.None.

To specify the focused row, use the FocusedRowHandle property or the DataViewBase.MoveFocusedRow method. If the specified row is not visible onscreen, a View is automatically scrolled to make the focused row visible.

After the focused row has been changed, the DataViewBase.FocusedRowHandleChanged event is raised.

Example: How to Focus a Cell with the Specified Value

This example shows how to identify a data cell with the specified value and focus it. To do this, click the 'Find Next' button. The search is performed starting from the currently focused row.

View Example

<Window x:Class="DXSample_FocusingCells.Window1" 
        Title="Focusing Cells" Height="300" Width="491">
            <RowDefinition Height="*" />
            <RowDefinition Height="32" />
        <dxg:GridControl Margin="5" Name="grid" AutoGenerateColumns="AddNew">
                <dxg:TableView x:Name="view" AutoWidth="True" ShowGroupPanel="False" AllowGrouping="False" NavigationStyle="Cell" />
        <Button Grid.Row="1" HorizontalAlignment="Left" Margin="2" Click="Button_Click">
            Find Next</Button>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DevExpress.Xpf.Grid;

namespace DXSample_FocusingCells {
    public partial class Window1 : Window {
        public Window1() {
            grid.ItemsSource = new nwindDataSetTableAdapters.ProductsTableAdapter().GetData();

        private void Button_Click(object sender, RoutedEventArgs e) {
            if (grid.VisibleRowCount == 0) return;
            int rowHandle = view.FocusedRowHandle + 1;
            while (Convert.ToDouble(grid.GetCellValue(rowHandle, "UnitPrice")) != 10 && 
                grid.IsValidRowHandle(rowHandle)) {
            if (grid.IsValidRowHandle(rowHandle)) {
                grid.CurrentColumn = grid.Columns["UnitPrice"];
                view.FocusedRowHandle = rowHandle;
See Also