Events in WPF Scheduler (SfScheduler)

19 Oct 202310 minutes to read

CellTapped

The CellTapped event occurs when the user clicks or touches the cell in Scheduler.
This event receives two arguments namely this that handles SfScheduler and CellTappedEventArgs as objects.

The CellTappedEventArgs object contains the following properties:

  • Appointment - returns Tapped appointment values.

    1. If ItemsSource added with custom business object then tapped custom Appointment details can get by using Appointment Data property in Cell tapped arguments.

    2. The tapped appointment is a Recurrence appointment it will return the parent recurrence appointment values.

    3. The appointment details get for month view if AppointmentDisplaymode as Appointment, or else it will be null for month view.

  • Appointments- returns Tapped Month cell appointments values if AppointmentDisplayMode as indicator. Tapped Month Cell has a Recurrence appointment it will return the parent recurrence appointment values. It will be null for Day or Week or WorkWeek views.
  • IsMoreAppointments- specifies whether more appointments are tapped or not in month view. It will be applicable only for Month view which has AppointmentDisplaymode as Appointment.
  • CancelNavigation- specifies whether day view navigation should be disabled when clicking more appointments in month view. It will be applicable for month view which has AppointmentDisplaymode as Appointment and click the More appointments in month cell.
  • DateTime- gets the date-time of the tapped cell.
  • TimeInterval- gets the date-time interval of the tapped cell. It is not applicable for month view.
  • Resource - gets the resource associated with the timeslot cell where user tapped.
<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month"
                        CellTapped="Scheduler_CellTapped" >
</syncfusion:SfScheduler>
private void Scheduler_CellTapped(object sender, CellTappedEventArgs e)
{
    var dateTime = e.DateTime.ToString();
}

CellDoubleTapped

The CellDoubleTapped event occurs when the user double clicks the cell in Scheduler. This event receives two arguments namely this that handles SfScheduler and CellDoubleTappedEventArgs as objects. The base class of the CellDoubleTappedEventArgs is CellTappedEventArgs

<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						CellDoubleTapped="Scheduler_CellDoubleTapped">
</syncfusion:SfScheduler>
private void Scheduler_CellDoubleTapped(object sender, CellDoubleTappedEventArgs e)
{
    var dateTime = e.DateTime.ToString();
}

CellLongPressed

The CellLongPressed event occurs when the user long presses the cell in Scheduler. This event receives two arguments namely this that handles SfScheduler and CellLongPressedEventArgs as objects. The base class of the CellLongPressedEventArgs is CellTappedEventArgs

<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						CellLongPressed="Schedule_CellLongPressed">
</syncfusion:SfScheduler>
private void Schedule_CellLongPressed(object sender, CellLongPressedEventArgs e)
{
    var dateTime = e.DateTime.ToString();
}

SelectionChanged

The SelectionChanged event occurs after the selection is changed in Scheduler. This event receives two arguments namely this that handles SfScheduler and SelectionChangedEventArgs as objects.

<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						SelectionChanged="Schedule_SelectionChanged">
</syncfusion:SfScheduler>
private void Schedule_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    var newdate = e.NewValue.ToString();
    var olddate = e.OldValue.ToString();
    var newResource = e.NewResource.ToString();
    var oldResource = e.OldResource.ToString();
}

The SelectionChangedEventArgs object contains the following properties:

  • OldValue - gets an old selected date.
  • NewValue- gets a new selected date.
  • OldResource - gets a old selected resource details.
  • newResource - gets a new selected resource details.

SelectionChanging

The SelectionChanging event occurs when the selection gets changing in Scheduler. This event receives two arguments namely this that handles SfScheduler and SelectionChangingEventArgs as objects.

The SelectionChanging object contains the following properties:

  • OldValue - gets an old selected date.
  • NewValue- gets a new selected date.
  • OldResource - gets a old selected resource details.
  • newResource - gets a new selected resource details.
<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						SelectionChanging="Schedule_SelectionChanging">
</syncfusion:SfScheduler>
private void Schedule_SelectionChanging(object sender, SelectionChangingEventArgs e)
{
    var newdate = e.NewValue.ToString();
    var olddate = e.OldValue.ToString();
    var newResource = e.NewResource.ToString();
    var oldResource = e.OldResource.ToString();
}

ViewChanged

The ViewChanged event is used to notify when the scheduler’s current view is changed, such as when the view is swiped to the previous or next view, or when the scheduler view is moved to another scheduler view.

  • Sender: This contains the SfScheduler object.

  • ViewChanged: The scheduler current view visible dates are available in the ViewChangedEventArgs when the scheduler visible dates or view is changed.

    • NewValue: Returns the new date range of the view.
    • OldValue : Returns the old date range of the view.
<scheduler:SfScheduler x:Name="Scheduler" 
                       ViewChanged="OnSchedulerViewChanged" >
</scheduler:SfScheduler>
this.Scheduler.ViewChanged += this.OnSchedulerViewChanged;

private void OnSchedulerViewChanged(object sender, ViewChangedEventArgs e)
{
    var oldValue = e.OldValue;
    var newValue = e.NewValue;
}

ViewHeaderCellTapped

The ViewHeaderCellTapped event occurs when the user clicks or touches the view header in Scheduler. This event receives two arguments namely this that handles SfScheduler and ViewHeaderCellTappedEventArgs as objects.

The ViewHeaderCellTappedEventArgs object contains the following properties:

  • DateTime - gets the corresponding date time.
  • Resource - gets the resource when tapped on view header in day, week, work week and timeline views.
<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						ViewHeaderCellTapped="Schedule_ViewHeaderCellTapped">
</syncfusion:SfScheduler>
private void Schedule_ViewHeaderCellTapped(object sender, ViewHeaderCellTappedEventArgs e)
{
    var dateTime = e.DateTime.ToString();
}

HeaderTapped

The HeaderTapped event occurs when the user clicks or touches the Scheduler header. This event receives two arguments namely this that handles SfScheduler and HeaderTappedEventArgs as objects.

The HeaderTappedEventArgs object contains the following properties:

  • DateTime - gets the corresponding date time.
<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						HeaderTapped="Schedule_HeaderTapped">
</syncfusion:SfScheduler>
private void Schedule_HeaderTapped(object sender, HeaderTappedEventArgs e)
{
    var dateTime = e.DateTime.ToString();
}

WeekNumberTapped

The WeekNumberTapped event occurs when the user clicks or touches the week number in month view. This event receives two arguments namely this that handles SfScheduler and WeekNumberTappedEventArgs as objects.

The WeekNumberTappedEventArgs object contains the following properties:

  • Month- gets the corresponding month.
  • WeekNumber- gets the corresponding week number.
  • Year- gets the corresponding year.
<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						WeekNumberTapped="Schedule_WeekNumberTapped">
</syncfusion:SfScheduler>
private void Schedule_WeekNumberTapped(object sender, WeekNumberTappedEventArgs e)
{
    var weeknumber = e.WeekNumber.ToString();
}

AppointmentTapped

The AppointmentTapped event occurs when schedule appointments get tapped in all views. This event receives two arguments namely this that handles SfScheduler and AppointmentTappedArgs as objects.

The AppointmentTappedArgs object contains the following properties:

  • Appointment- gets the custom appointment details
  • SelectedDate- gets the SelectedDate details
  • Resource - gets the resource details under which the appointment is located.
<syncfusion:SfScheduler x:Name="Schedule"
                        ViewType="Month" 
						AppointmentTapped="Schedule_AppointmentTapped">
</syncfusion:SfScheduler>
private void Schedule_AppointmentTapped(object sender, AppointmentTappedArgs e)
{
    var appointment = e.Appointment.ToString();
}

NOTE

You can refer to our WPF Scheduler feature tour page for its groundbreaking feature representations. You can also explore our WPF Scheduler example to knows how to schedule and manage appointments through an intuitive user interface, similar to the Outlook calendar.