Version

Appointments Property (AppointmentsDragDropEventArgs)

Returns a read-only collection of the appointments that were dragged.
Syntax
'Declaration
 
Public ReadOnly Property Appointments As ReadOnlyAppointmentsCollection
public ReadOnlyAppointmentsCollection Appointments {get;}
Remarks

The Appointments property returns a read-only collection consisting of the actual appointments that were dragged, with start and end times that reflect the result of the drag operation. The CopiedAppointments property, by contrast, returns clones of the appointments that were dragged. For example, if an appointment is dragged from the current day to the following day, and the control key is pressed before the drag operation is completed, the Appointments property returns the same instance as the appointment that was dragged to the following day, and the CopiedAppointments property returns the one that belongs to the current day. When the drag operation is completed, the SelectedAppointments collection contains the same instances as those returned by the Appointments property.

To support legacy behavior, the SelectedAppointments collection is cleared when the active owner changes. Unless the ClearSelectedAppointments property is explicitly set to false by a listener, the dragged appointments are deselected immediately after this event fires, if the owner on which they are dropped is different than the inital owner.

Example
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
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;
        }
    }
Requirements

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

See Also