New to Telerik UI for WPF? Download free 30-day trial

Events

The RadCalendar exposes three events that can be handled: SelectionChanged, DisplayDateChanged and DisplayModeChanged. The events are routed events but can also be handled like normal events:

public partial class Default_Cs : UserControl 
{ 
       public Default_Cs () 
    { 
           this.InitializeComponent(); 
           calendar.SelectionChanged += calendar_SelectionChanged; 
 
           calendar.SelectionChanged +=calendar_SelectionChanged; 
    } 
 
       void calendar_SelectionChanged(object sender, SelectionChangedEventArgs e) 
       { 
           message.Text = String.Format("{0} dates have been selected.", calendar.SelectedDates.Count); 
       } 
 
} 

<StackPanel> 
    <telerik:RadCalendar x:Name="calendar" SelectionMode="Extended"/> 
    <TextBlock x:Name="message" /> 
</StackPanel> 

The real power of the RoutedEvents lies in the fact that they can be handled by any parent in the visual tree of the element that raised them.

This can be very helpful when notification is needed from controls that are part of data templates and as such are nor easily accessible.

The following example shows how to sign up for the SelectionChanged event at a parent panel of the RadCalendar.

public Page() 
{ 
    InitializeComponent(); 
    //Sign up for the event: 
    this.LayoutRoot.AddHandler(RadCalendar.SelectionChangedEvent, new SelectionChangedEventHandler(OnCalendarSelectionChanged)); 
} 
 
private void OnCalendarSelectionChanged(object sender, SelectionChangedEventArgs e) 
{ 
} 
In this article