Skip to main content

DataViewBase.GetRowHandleByMouseEventArgs(MouseEventArgs) Method

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

Namespace: DevExpress.Xpf.Grid

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

#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 grid_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) {
    int rowHandle = grid.View.GetRowHandleByMouseEventArgs(e as System.Windows.Input.MouseButtonEventArgs);
    MessageBox.Show(GetRowType(rowHandle), "Hit Info", MessageBoxButton.OK);
}
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