New to Telerik UI for WPF? Start a free 30-day trial
Get Click Coordinates Relative to the Image of RadImageEditor
Updated on Sep 15, 2025
Environment
| Product Version | 2021.2.511 |
| Product | RadImageEditor for WPF |
Description
How to get the image cooridnates of the clicked point in the RadImageEditor control.
Solution
To do this, you can subscribe to the MouseLeftButtonDown event of RadImageEditor and calculate the coordinates based on the mouse position, the image size and the control's size.
C#
public MainWindow()
{
InitializeComponent();
this.imageEditor.AddHandler(RadImageEditor.MouseLeftButtonDownEvent, new MouseButtonEventHandler(imageEditor_MouseLeftButtonDown), true);
}
private void imageEditor_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var image = e.OriginalSource as Image;
if (image != null)
{
Point mousePosition = e.GetPosition(image);
double relativeWidth = mousePosition.X / image.ActualWidth;
double relativeHeight = mousePosition.Y / image.ActualHeight;
var originalImageWidth = ((WriteableBitmap)image.Source).PixelWidth;
var originalImageHeight = ((WriteableBitmap)image.Source).PixelHeight;
var pixelXPosition = originalImageWidth * relativeWidth;
var pixelYPosition = originalImageHeight * relativeHeight;
}
}