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

SpreadsheetControl.GetCellFromPoint(PointF) Method

Gets a worksheet cell located at the specified point.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v24.2.dll

NuGet Package: DevExpress.Wpf.Spreadsheet

#Declaration

public Cell GetCellFromPoint(
    PointF clientPoint
)

#Parameters

Name Type Description
clientPoint PointF

A PointF structure specifying the location for which the position is retrieved. The point coordinates are measured in documents units.

#Returns

Type Description
Cell

A Cell object.

#Remarks

The code sample below obtain a cell by the clicked point:

using DevExpress.Xpf.Core;
using System.Windows.Input;
using DevExpress.Spreadsheet;
using System.Drawing;

private void spreadsheet_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
    System.Windows.Point p = e.GetPosition(spreadsheet);
    Cell cell = spreadsheet.GetCellFromPoint(new System.Drawing.PointF((float)p.X, (float)p.Y));
    if(cell != null)
    {
      //your code here
    }
} 
See Also