This is a migrated thread and some comments may be shown as answers.

Double click handler possible?

2 Answers 91 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 03 Apr 2012, 02:19 PM
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 Answers, 1 is accepted

Sort by
0
KI performance
Top achievements
Rank 1
answered on 30 Jul 2013, 08:45 AM
I have the same question!

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

Greetings!
0
Ventzi
Telerik team
answered on 01 Aug 2013, 10:04 AM
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 >>
Tags
Calendar
Asked by
Chris
Top achievements
Rank 1
Answers by
KI performance
Top achievements
Rank 1
Ventzi
Telerik team
Share this question
or