Edit this page

Get the Row or Column Index of the Mouse Position

In a scenario when the row/column index for the mouse position is needed, the GetRowIndexAtMousePosition and GetColumnIndexAtMousePosition methods come in handy. In order to return the needed index, they accept a parameter of type CanvasInputBorder. This Border is used internally by RadVirtualGrid to enable mouse interaction with the control. For example, if the row and column indexes for the MouseRightButtonDown event of RadVirtualGrid are needed, its event handler would be similar to the following one.

Example 1: Getting the Row and Column Index on MouseRightButtonDown event

private void VirtualGrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
    {
        var border = e.OriginalSource as CanvasInputBorder;
        var columnIndex = this.VirtualGrid.GetColumnIndexAtMousePosition(border);
        var rowIndex = this.VirtualGrid.GetRowIndexAtMousePosition(border);
    }

See Also

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy