Load Current Date on Double Click

3 posts, 1 answers
  1. David
    David avatar
    2 posts
    Member since:
    Jun 2011

    Posted 01 Jun 2011 Link to this post

    I am trying to populate the current date in a RadDateTimePicker when I double click on the control, but while trying to override the OnMouseLeftButtonUp(Or down) the overriden event doesn't seem to be fired. 

    protected override void  OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e)
    {
         //Code to handle the double click here
    }


    Is there a way to accomplish loading the current date on a double click in the control?
  2. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 03 Jun 2011 Link to this post

    Hello David,

    In order to achieve this you will need to create an attached property and handle the MouseClick there. Please find attached a sample project in which this is illustrated.

    Hope this helps.

    Best wishes,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. David
    David avatar
    2 posts
    Member since:
    Jun 2011

    Posted 06 Jun 2011 Link to this post

    Thanks for the help, that worked.  From your answer I also thought of adding a new event that would accomplish the same thing.
     
    class DateEditor:RadDateTimePicker
        {
      
            public DateEditor()
            {
                AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(NewMouseLeftButtonDown), true);
            }
      
            private void NewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            {
                var dropDownDateEditorNew = sender as DropDownDateEditorNew;
      
                dropDownDateEditorNew.SelectedDate = DateTime.Now;              
            }
      
        }
Back to Top