Double click handler possible?

3 posts, 0 answers
  1. Chris
    Chris avatar
    34 posts
    Member since:
    Jul 2011

    Posted 03 Apr 2012 Link to this post

    Hi,

    Is it possible to implement a double-click handler for the Silverlight Calendar control?  i.e. I double-click on a date and it runs different code than for a single click.

    Also - is it possible to add a tickbox next to each date at all in the calendar - something like in the attached image?

    Thanks

    Chris
  2. KI performance
    KI performance avatar
    13 posts
    Member since:
    Jun 2013

    Posted 30 Jul 2013 Link to this post

    I have the same question!

    double click event in Silverlight Calendar Control, to open a child window with the double-clicked-eventdate! 

    Greetings!
  3. DevCraft banner
  4. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 01 Aug 2013 Link to this post

    Hi Chris,

     Double click on the RadCalendar control could be easily achieved by using AddHandler method like following:

    this.radCalendar.AddHandler(RadCalendar.MouseLeftButtonDownEvent, new MouseButtonEventHandler(MouseDoubleClick), true);
    ....
    private void MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
      if (e.ClickCount == 2 && ((UIElement)e.OriginalSource).ParentOfType<RadCalendar>() != null)
      {
          //Do something
      }
    }

    If you like to have a double click on each calendar button you could create custom DayTemplateSelector by inheriting from DataTemplateSelector where you should override the SelectTemplate method. The code inside this method should look like the following:

    CalendarButtonContent content = item as CalendarButtonContent;
    if (content.ButtonType == CalendarButtonType.Date || content.ButtonType == CalendarButtonType.TodayDate)
    {
        ((CalendarButton)container).AddHandler(CalendarButton.MouseLeftButtonDownEvent, new MouseButtonEventHandler(MouseDoubleClick), true);
    }
    return base.SelectTemplate(item, container);

    In the event handler you should cast the sender to CalendarButton in order to get the Text property of the button.

    Would you please share with us what you are trying to achieve with so many check boxes? If you are trying to get multiple/extended selection you could set the SelectionMode property of the RadCalendar to "Extended". More about this could be found here.

    Hope this helps.
    Regards,
    Ventzi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top