void gcCalendarGrid_AppointmentCellDragging(object sender, AppointmentCellDraggingEventArgs e)
{
//The following code will make the appointment limited between 2014/1/1 and 2014/1/31, and the original appointment date cannot be changed to shorter.
if (e.StartCellPosition.RowIndex == 1 && e.StartCellPosition.ColumnIndex == 0)
{
if (e.DraggingHandle == HandlePosition.Left)
{
if (e.TargetCellPosition.Date >= new DateTime(2014, 1, 1) && e.TargetCellPosition.Date <= e.StartCellPosition.Date)
{
e.AllowDrop = true;
}
else
{
e.AllowDrop = false;
}
}
else if(e.DraggingHandle == HandlePosition.Right)
{
if (e.TargetCellPosition.Date <= new DateTime(2014, 1, 31) && e.TargetCellPosition.Date >= e.EndCellPosition.Date)
{
e.AllowDrop = true;
}
else
{
e.AllowDrop = false;
}
}
}
}
Private Sub gcCalendarGrid_AppointmentCellDragging(sender As Object, e As AppointmentCellDraggingEventArgs)
'The following code will make the appointment limited between 2014/1/1 and 2014/1/31, and the original appointment date cannot be changed to shorter.
If e.StartCellPosition.RowIndex = 1 AndAlso e.StartCellPosition.ColumnIndex = 0 Then
If e.DraggingHandle = HandlePosition.Left Then
If e.TargetCellPosition.[Date] >= New DateTime(2014, 1, 1) AndAlso e.TargetCellPosition.[Date] <= e.StartCellPosition.[Date] Then
e.AllowDrop = True
Else
e.AllowDrop = False
End If
ElseIf e.DraggingHandle = HandlePosition.Right Then
If e.TargetCellPosition.[Date] <= New DateTime(2014, 1, 31) AndAlso e.TargetCellPosition.[Date] >= e.EndCellPosition.[Date] Then
e.AllowDrop = True
Else
e.AllowDrop = False
End If
End If
End If
End Sub