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
close icon

SFDiagram- MouseLeftButtonDown getting mouse position relative to a page


Hi ,

I am trying to get the position of the cursor relative to the page

Looks like that the following code doensot get the correct point and i need to do some translation?


  private void Diagram_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
          var point =       e.GetPosition(diagram)

  }

Thanks in advance

Tomer

2 Replies

TO tomer September 14, 2016 08:11 AM UTC


Answering to myself....need to use diagram.Page


e.GetPosition(diagram.Page)


KR Keerthivasan Ramamoorthy Syncfusion Team September 15, 2016 06:11 AM UTC

Hi Tomer, 
Yes, Please get the position of Mouse with respect to Page. We have provided a code example to represent this. Please refer to the below code example. 
 
Code example: 
//MouseLeftButtonDown 
diagram.MouseLeftButtonDown += diagram_MouseLeftButtonDown; 
 
void diagram_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 
{ 
Point point = e.GetPosition(diagram.Page); 
} 
 
Here, diagram is instance of SfDiagram. 
 
 
 
Regards, 
Keerthivasan R. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon