Wrong date selected in double click

2 posts, 0 answers
  1. Inger Marie
    Inger Marie avatar
    86 posts
    Member since:
    Nov 2010

    Posted 22 Dec 2011 Link to this post

    I have a raddatetimepicker in my application. When I open the pop-up it will show the days of the months.. and the last days of the last month and the first days of the next month.

    Lets say that the date already selected i 24th november 2011. When I open the pop-up, I can select the 2nd december without changing the month. That works.. but if I double-click on the 2nd december, it chooses 30th december, not 2nd.

    I have implemented the mousedoubleclick event:

      void RadDateTimePicker_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
                if (((RadDateTimePicker)sender).IsDropDownOpen)
                    ((RadDateTimePicker)sender).IsDropDownOpen = false;
                else if (((RadDateTimePicker)sender).SelectedValue == null)
                    ((RadDateTimePicker)sender).SelectedValue = DateTime.Now;
                e.Handled = true;

    The selected value is the 30th december, not the 2nd december in the mousedoubleclick-handler.

    It there any way to make sure that a doubleclick selects the intended date (and closes the pop-up-dialog)?

    This error only appears when the popup dialog shows a specific month and I click on the "grey-out" dates in the surounding months.

  2. Yana
    Yana avatar
    4604 posts

    Posted 23 Dec 2011 Link to this post

    Hello Inger,

    The problem is that when you close the dropdown like this, it doesn't switch to the next month and the wrong date is selected. I would suggest to set also DisplayDate property and use PreviewMouseDoubleClick event. I've attached my test project to show the needed changes, please download it and give it a try.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top