New to Telerik UI for WPF? Start a free 30-day trial
Get cell from Point
Updated on Sep 15, 2025
This article describes how you can get a cell index by using a specific location on the screen.
In order to get the cell under the mouse you need the position related to the top left corner of the grid that contains all cells. This is why you need to get the position relative to the WorksheetEditorPresenter. Then you can use the GetCellIndexFromViewPoint method to get the cell under the mouse.
C# Example 1: Get the cell under the mouse
C#
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
var worksheetEditor = this.radSpreadsheet.ActiveWorksheetEditor;
if (worksheetEditor != null)
{
var presenter = worksheetEditor.ActivePresenter as NormalWorksheetEditorPresenter;
presenter.PreviewMouseMove += Presenter_PreviewMouseMove;
}
}
private void Presenter_PreviewMouseMove(object sender, MouseEventArgs e)
{
var presenter = sender as NormalWorksheetEditorPresenter;
Point position = e.GetPosition(presenter);
CellIndex clickedCellIndex = presenter.GetCellIndexFromViewPoint(position);
string clickValue = String.Format("Hovered!");
this.radSpreadsheet.ActiveWorksheet.Cells[clickedCellIndex].SetValue(clickValue);
}