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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get DateTime from coordinates?

Thread ID:

Created:

Updated:

Platform:

Replies:

124223 May 25,2016 12:11 PM UTC May 26,2016 05:09 AM UTC WPF 1
loading
Tags: SfSchedule
Roman Shevchenko
Asked On May 25, 2016 12:11 PM UTC

When I right-click on the schedule a ContextmenuEvent is triggered that has ContextMenuOpeningEventArgs.CurrentSelectedDate member set to DateTime corresponding to the current mouse location.
Is there a way to get DateTime based on coordinates without right-clicking the mouse? I couldn't find a public method for this. I want to implement drag-and-drop capability for the schedule, so a user can drop items on the schedule
using either a mouse or stylus. For that, I would like to get current mouse or stylus coordinates, pass them to this method and get DateTime. Can you please add such a method?

Vigneshkumar Ramasamy [Syncfusion]
Replied On May 26, 2016 05:09 AM UTC

Hi Roman, 
Thanks for using Syncfusion product. 
As of now your requirement of getting time based on coordinates without using click event can be achieved by using MouseMove event for schedule control. Based on your requirement we have prepared a sample and please find the sample in the below link. 
Sample link: SfSchedule_DateTime
 
In the above sample we have used the below method to get the time based on the mouse point of ScheduleDayView. 
  
 private DateTime PointToDate(Point point) 
        { 
            draggingTime = new DateTime(); 
 
            var total = (point.Y / hourHeight); 
            var hour = (int)total; 
            var decimalvalue = (total - hour) * 60; 
            var min = schedule.TimeInterval != 0 ? (int)decimalvalue : 0; 
 
            if (total > 0) 
                draggingTime = draggingTime.AddHours(hour >= 0 ? hour : 0).AddMinutes(min); 
 
            return draggingTime; 
        } 
 
 
Regards 
Vigneshkumar R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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

;