By default, end-users are allowed to drag and drop appointments between the resources currently visible in the scheduling area (if more than one resource is displayed). Use the AllowAppointmentDragBetweenResources property to control the availability of such functionality to end-users with respect to an appointment's specific type.

Example
This example demonstrates how to implement custom rules for editing and deleting appointments. The code below allows an appointment to be edited only by its owner (the end-user who created it). To do this it's necessary to set the AllowAppointmentEdit and AllowAppointmentDelete properties to UsedAppointmentType.Custom, and handle the DevExpress.XtraScheduler.SchedulerControl.AllowAppointmentEdit and DevExpress.XtraScheduler.SchedulerControl.AllowAppointmentDelete events to implement custom logic for editing appointments.
C# |
using DevExpress.XtraScheduler;
private void schedulerControl1_AllowAppointmentDelete(object sender,
AppointmentOperationEventArgs e) {
e.Allow = CanUserModifyThisAppointment(e.Appointment);
}
private void schedulerControl1_AllowAppointmentEdit(object sender,
AppointmentOperationEventArgs e) {
e.Allow = CanUserModifyThisAppointment(e.Appointment);
}
bool CanUserModifyThisAppointment(Appointment apt) {
object obj = apt.CustomFields["Owner"];
if (obj == null)
return true;
string appointmentOwner = obj.ToString();
if (appointmentOwner == String.Empty)
return true;
return (String.Compare(appointmentOwner, tbUserName.Text, true) == 0);
}
|
VB |
Imports DevExpress.XtraScheduler
Private Sub schedulerControl1_AllowAppointmentDelete(ByVal sender As Object, _
ByVal e As AppointmentOperationEventArgs)
e.Allow = CanUserModifyThisAppointment(e.Appointment)
End Sub
Private Sub schedulerControl1_AllowAppointmentEdit(ByVal sender As Object, _
ByVal e As AppointmentOperationEventArgs)
e.Allow = CanUserModifyThisAppointment(e.Appointment)
End Sub
Private Function CanUserModifyThisAppointment(ByVal apt As Appointment) As Boolean
Dim obj As Object = apt.CustomFields("Owner")
If obj Is Nothing Then
Return True
End If
Dim appointmentOwner As String = obj.ToString()
If appointmentOwner = String.Empty Then
Return True
End If
Return (String.Compare(appointmentOwner, tbUserName.Text, True) = 0)
End Function
|