Calendar - Cancel Navigation on doubleclick of day from other month

2 posts, 0 answers
  1. scottw
    scottw avatar
    21 posts
    Member since:
    Oct 2010

    Posted 09 Jun 2014 Link to this post

    When using Month view, if the user double clicks on a day from another month (previous or next), the calendar navigates to that month before raising MouseDoubleClick on the calendar of DoubleClick on the CalendarCellElement. Is there any way to cancel this navigation and / or another event that fires before the navigation on a double click? I am trying to take action when the user double clicks on a date, but I am losing the date that was clicked because of the navigation. 

    For example, If I am displaying the month of June 2014 in the calendar with month view (7 columns x 6 rows horizontal, Monday as the first day of the week) and the user double clicks on the 3rd cell in the first row (representing Wed. May 28), when the CalendarCellElement's DoubleClick event is raised, the Date of the CalendarCellElement is April 2, 2014 (the new date for that cell in the calendar after navigating to the previous month).  I want to either 1) (preferred) capture this event before the navigation so that I may take action on 5/31 OR 2) Prevent the DoubleClick from firing
  2. Dess
    Dess avatar
    1562 posts

    Posted 12 Jun 2014 Link to this post

    Hello Scott,

    Thank you for writing.

    It is possible to cancel the view changing when a day from the previous/next month is selected. You can use the SelectionChanging event to set a Boolean flag to true and cancel the ViewChanging event:
    bool cancelViewChanging = false;
    public Form1()
        this.radCalendar1.ViewChanging += radCalendar1_ViewChanging;
    private void radCalendar1_ViewChanging(object sender, Telerik.WinControls.UI.ViewChangingEventArgs e)
        e.Cancel = cancelViewChanging;
    private void radCalendar1_SelectionChanged(object sender, EventArgs e)
        cancelViewChanging = false;
    private void radCalendar1_SelectionChanging(object sender, Telerik.WinControls.UI.SelectionEventArgs e)
        cancelViewChanging = true;

    I hope this information helps. Should you have further questions, I would be glad to help.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. DevCraft R3 2016 release webinar banner
Back to Top