Skip to main content
A newer version of this page is available. .

DataViewBase.GetRowHandleByMouseEventArgs(MouseEventArgs) Method

Returns the handle of a row located under the mouse pointer.

Namespace: DevExpress.Xpf.Grid

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Grid.Core, DevExpress.Wpf.Grid.Core

Declaration

public int GetRowHandleByMouseEventArgs(
    MouseEventArgs e
)

Parameters

Name Type Description
e MouseEventArgs

A MouseEventArgs object or its descendant, that contains data for mouse-related events.

Returns

Type Description
Int32

An integer value that specifies the handle of the row located under the mouse pointer.

Remarks

The following example shows how to obtain which row has been clicked.

private void TableView_MouseDown(object sender, MouseButtonEventArgs e) {
    int rowHandle = grid.View.GetRowHandleByMouseEventArgs(e as MouseEventArgs);
    MessageBox.Show(GetRowType(rowHandle), "Hit Info");
}
private string GetRowType(int rowHandle) {
    if (grid.IsGroupRowHandle(rowHandle))
        return "Group Row";
    if (rowHandle == GridControl.AutoFilterRowHandle)
        return "Automatic Filter Row";
    if (rowHandle == GridControl.NewItemRowHandle)
        return "New Item Row";
    if (rowHandle == GridControl.InvalidRowHandle)
        return "Invalid Row";
    return "Data Row";
}

To learn more, see Obtaining Row Handles.

See Also