The following example demonstrates how to use the parameters of the 'BeforeDisplayAppointmentRecurrenceDialog' event.
For an overview of how to handle events in Visual Basic or Visual C#, see
Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see
Consuming Events in the
.NET Framework Developer's Guide.
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
Private Sub ultraCalendarInfo1_BeforeDisplayAppointmentRecurrenceDialog(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.DisplayAppointmentRecurrenceDialogEventArgs) Handles ultraCalendarInfo1.BeforeDisplayAppointmentRecurrenceDialog
' The 'BeforeDisplayAppointmentRecurrenceDialog' event is
' invoked from the built in UltraWinSchedule appointment
' dialog when the Recurrence button is pressed and provides
' an opportunity to prevent the dialog from being displayed
' or modify what may be done.
'
' the 'IsExistingRecurrence' parameter indicates if the appointment
' originally was part of a recurrence
If Not e.IsExistingRecurrence Then
' the 'Cancel' parameter can be used to prevent the dialog
' from being displayed. in this case, we will not allow
' new recurrences to be created.
e.Cancel = True
Else
Dim recurrence As AppointmentRecurrence
' get the recurrence - this should be available
' since this block will only be executed if the
' 'IsExistingRecurrence' is true
If e.Appointment.IsRecurringAppointmentRoot Then
recurrence = e.Appointment.Recurrence
Else
recurrence = e.Appointment.RecurringAppointmentRoot.Recurrence
End If
' by default, a recurrence is allowed to continue without
' a limit (see AppointmentRecurrence.RangeLimit) but the
' 'AllowNoEndDate' parameter can be used to prevent the user
' from being able to specify that the recurrence has no end date.
'
' if the appointment recurrence was created with a limit
' do not allow the user to set this to not have a limit
If recurrence.RangeLimit <> RecurrenceRangeLimit.NoLimit Then
e.AllowNoEndDate = False
End If
End If
End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;
private void ultraCalendarInfo1_BeforeDisplayAppointmentRecurrenceDialog(object sender, Infragistics.Win.UltraWinSchedule.DisplayAppointmentRecurrenceDialogEventArgs e)
{
// The 'BeforeDisplayAppointmentRecurrenceDialog' event is
// invoked from the built in UltraWinSchedule appointment
// dialog when the Recurrence button is pressed and provides
// an opportunity to prevent the dialog from being displayed
// or modify what may be done.
//
// the 'IsExistingRecurrence' parameter indicates if the appointment
// originally was part of a recurrence
if (!e.IsExistingRecurrence)
{
// the 'Cancel' parameter can be used to prevent the dialog
// from being displayed. in this case, we will not allow
// new recurrences to be created.
e.Cancel = true;
}
else
{
AppointmentRecurrence recurrence;
// get the recurrence - this should be available
// since this block will only be executed if the
// 'IsExistingRecurrence' is true
if (e.Appointment.IsRecurringAppointmentRoot)
recurrence = e.Appointment.Recurrence;
else
recurrence = e.Appointment.RecurringAppointmentRoot.Recurrence;
// by default, a recurrence is allowed to continue without
// a limit (see AppointmentRecurrence.RangeLimit) but the
// 'AllowNoEndDate' parameter can be used to prevent the user
// from being able to specify that the recurrence has no end date.
//
// if the appointment recurrence was created with a limit
// do not allow the user to set this to not have a limit
if (recurrence.RangeLimit != RecurrenceRangeLimit.NoLimit)
e.AllowNoEndDate = false;
}
}
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2