The following code sample demonstrates how to use the AppointmentsDragDrop method to maintain a history of appointment ownership changes:
Imports System.Collections.Generic
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
AddHandler Me.dayView.AppointmentsDragDrop, AddressOf OnAppointmentsDragDrop
Private Sub OnAppointmentsDragDrop(ByVal sender As Object, ByVal e As AppointmentsDragDropEventArgs)
If Not (e.NewOwner Is e.InitialOwner) Then
Dim scheduleControl As UltraScheduleControlBase = sender
Dim changeHistory As List(Of AppointmentOwnershipChangeHistoryItem) = scheduleControl.Tag
If changeHistory Is Nothing Then
changeHistory = New List(Of AppointmentOwnershipChangeHistoryItem)
End If
changeHistory.Add(New AppointmentOwnershipChangeHistoryItem(DateTime.Now, e.InitialOwner, e.NewOwner, e.Appointments, e.HasCopies))
scheduleControl.Tag = changeHistory
End If
End Sub
Public Structure AppointmentOwnershipChangeHistoryItem
Public timeStamp As DateTime
Public copied As Boolean
Public initialOwner As Owner
Public newOwner As Owner
Public appointments As ReadOnlyAppointmentsCollection
Public Sub New(ByVal timeStamp As DateTime, ByVal initialOwner As Owner, ByVal newOwner As Owner, ByVal appointments As ReadOnlyAppointmentsCollection, ByVal copied As Boolean)
Me.timeStamp = timeStamp
Me.initialOwner = initialOwner
Me.newOwner = newOwner
Me.appointments = appointments
Me.copied = copied
End Sub
End Structure
'Declaration
Public ReadOnly Property NewOwner As Owner
using System.Collections.Generic;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;
this.dayView.AppointmentsDragDrop += new AppointmentsDragDropHandler(OnAppointmentsDragDrop);
private void OnAppointmentsDragDrop(object sender, AppointmentsDragDropEventArgs e)
{
if ( e.NewOwner != e.InitialOwner )
{
UltraScheduleControlBase scheduleControl = sender as UltraScheduleControlBase;
List<AppointmentOwnershipChangeHistoryItem> changeHistory = scheduleControl.Tag as List<AppointmentOwnershipChangeHistoryItem>;
if ( changeHistory == null )
changeHistory = new List<AppointmentOwnershipChangeHistoryItem>();
changeHistory.Add( new AppointmentOwnershipChangeHistoryItem( DateTime.Now, e.InitialOwner, e.NewOwner, e.Appointments, e.HasCopies ) );
scheduleControl.Tag = changeHistory;
}
}
public struct AppointmentOwnershipChangeHistoryItem
{
public DateTime timeStamp;
public bool copied;
public Owner initialOwner;
public Owner newOwner;
public ReadOnlyAppointmentsCollection appointments;
public AppointmentOwnershipChangeHistoryItem( DateTime timeStamp, Owner initialOwner, Owner newOwner, ReadOnlyAppointmentsCollection appointments, bool copied )
{
this.timeStamp = timeStamp;
this.initialOwner = initialOwner;
this.newOwner = newOwner;
this.appointments = appointments;
this.copied = copied;
}
}
'Declaration
Public ReadOnly Property NewOwner As Owner
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