We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the x and y coordinates with respect to PdfViewerControl in MouseUp event?

Platform: WPF |
Control: PdfViewer |
Published Date: August 7, 2018 |
Last Revised Date: May 21, 2020

You can get the coordinates of mouse pointer with respect to PdfViewerControl by using Mouse_Up event of the PdfViewerControl.

You can refer to the following steps

Step 1:  Add the following code in the MainWindow.xaml.


<Window x:Class="FindCoordinatesWpf.MainWindow"
        Title="MainWindow" Height="350" Width="525" WindowState="Maximized">
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="1*"/>
        <syncfusion:PdfViewerControl x:Name="PdfViewer" Grid.Column="0"/>
        <GroupBox VerticalAlignment="Center" Grid.Column="1" Margin="20">
                <TextBlock Text="Coordinates" FontSize="16" FontWeight="Bold"></TextBlock>
                <StackPanel Orientation="Horizontal" Grid.Row="0">
                    <Label Content="X : " FontSize="16" Margin="20,10,0,10"/>
                    <Label x:Name="xLabel" FontSize="16" Margin="0,10,0,10"/>
                <StackPanel Orientation="Horizontal" Grid.Row="1">
                    <Label Content="Y : " FontSize="16"  Margin="20,10,0,10"/>
                    <Label x:Name="yLabel" FontSize="16" Margin="0,10,0,10"/>

Step 2: Add the below code snippet in the MainWindow.xaml.cs


using System.Windows;

using System.Windows.Input;


namespace FindCoordinatesWpf


    /// <summary>

    /// Interaction logic for MainWindow.xaml

    /// </summary>

    public partial class MainWindow : Window


        public MainWindow()



            PdfViewer.Load("../../Data/GIS Succinctly.pdf");

            PdfViewer.MouseUp += PdfViewer_MouseUp;



        private void PdfViewer_MouseUp(object sender, MouseButtonEventArgs e)


            System.Drawing.Point position = new System.Drawing.Point


                X = (int)e.GetPosition(PdfViewer).X,

                Y = (int)e.GetPosition(PdfViewer).Y


            //Displays the x and y coordinates

            xLabel.Content = position.X;

            yLabel.Content = position.Y;





Sample link:

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon