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

DataViewBase.GetRowHandleByMouseEventArgs(MouseEventArgs) Method

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

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: 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