Version

DataBindingsForAppointments Property

Data binding properties for appointments.
Syntax
'Declaration
 
Public ReadOnly Property DataBindingsForAppointments As AppointmentsDataBinding
public AppointmentsDataBinding DataBindingsForAppointments {get;}
Example
The following code creates a Datatable with the proper schema to bind to the Appointments collection of an UltraCalendarInfo and then sets all the appropriate bindings.

#Region " CreateAppointmentsDataTable "
    'Create the structure of the Appointments Table
    Private Function CreateAppointmentsDataTable() As DataTable
        Dim newTable As DataTable = New DataTable()

        'Basic Appointment properties
        ' In order to function properly, the table must contain data for 
        ' Subject, StartDateTime, and EndDateTime. These three fields are 
        ' required for an appointment. So all of these will have DefaultValues.
        newTable.Columns.Add("Subject", GetType(String))
        newTable.Columns("Subject").DefaultValue = "New Appointment"
        newTable.Columns.Add("StartDateTime", GetType(DateTime))
        newTable.Columns("StartDateTime").DefaultValue = DateTime.Now
        newTable.Columns.Add("EndDateTime", GetType(DateTime))
        newTable.Columns("EndDateTime").DefaultValue = DateTime.Now.AddHours(1)
        newTable.Columns.Add("Description", GetType(String))

        ' All other fields are Optional.

        'Properties for AllDayEvents
        newTable.Columns.Add("AllDayEvent", GetType(Boolean))
        newTable.Columns("AllDayEvent").DefaultValue = False

        'Properties for Reminders
        newTable.Columns.Add("ReminderEnabled", GetType(Boolean))
        newTable.Columns("ReminderEnabled").DefaultValue = False
        newTable.Columns.Add("ReminderInterval", GetType(Integer))
        newTable.Columns.Add("ReminderUnits", GetType(Integer))

        'Properties when imports owners
        newTable.Columns.Add("OwnerKey", GetType(String))

        'Properties when imports recurring appointments. 
        newTable.Columns.Add("RecurrenceId", GetType(System.Guid))
        newTable.Columns.Add("Recurrence", GetType(Byte()))
        newTable.Columns.Add("OriginalStartDateTime", GetType(DateTime))

        'DataKey is an extra field that can be used to link the appointment to some external data. 
        newTable.Columns.Add("DataKey", GetType(String))

        'All properties 			
        ' Any other Appointment properties not covered above are stored as 
        ' Binary data in the AllProperties field. This includes properties like 
        ' BarColor, Location, etc. 
        newTable.Columns.Add("AllProperties", GetType(Byte()))

        Return newTable
    End Function
#End Region

#Region " SetAppointmentBindings"
    'Set the Data Bindings for Appointments
    Private Sub SetAppointmentBindings()
			'	Get the data
			Me.scheduleData.Tables.Add( Me.CreateAppointmentsDataTable() )

        ' Set the BindingContextControl so the component will use the same context
        ' that the grid and any other controls on the form are using. 
        Me.ultraCalendarInfo1.DataBindingsForAppointments.BindingContextControl = Me

        ' Basic Appointment properties
        Me.ultraCalendarInfo1.DataBindingsForAppointments.SubjectMember = "Subject"
        Me.ultraCalendarInfo1.DataBindingsForAppointments.DescriptionMember = "Description"

        Me.ultraCalendarInfo1.DataBindingsForAppointments.StartDateTimeMember = "StartDateTime"
        Me.ultraCalendarInfo1.DataBindingsForAppointments.EndDateTimeMember = "EndDateTime"
        Me.ultraCalendarInfo1.DataBindingsForAppointments.AllDayEventMember = "AllDayEvent"

        Me.ultraCalendarInfo1.DataBindingsForAppointments.ReminderEnabledMember = "ReminderEnabled"
        Me.ultraCalendarInfo1.DataBindingsForAppointments.ReminderIntervalMember = "ReminderInterval"
        Me.ultraCalendarInfo1.DataBindingsForAppointments.ReminderUnitsMember = "ReminderUnits"

        'Properties when imports owners
        Me.ultraCalendarInfo1.DataBindingsForAppointments.OwnerKeyMember = "OwnerKey"

        'Properties when imports recurring appointments. 
        Me.ultraCalendarInfo1.DataBindingsForAppointments.RecurrenceIdMember = "RecurrenceId"
        Me.ultraCalendarInfo1.DataBindingsForAppointments.RecurrenceMember = "Recurrence"
        Me.ultraCalendarInfo1.DataBindingsForAppointments.OriginalStartDateTimeMember = "OriginalStartDateTime"

        ' All other properties
        Me.ultraCalendarInfo1.DataBindingsForAppointments.AllPropertiesMember = "AllProperties"

        'DataKey is an extra field that can be used to link the appointment to some external data. 
        Me.ultraCalendarInfo1.DataBindingsForAppointments.DataKeyMember = "DataKey"

        ' DataSource & DataMember
        Me.ultraCalendarInfo1.DataBindingsForAppointments.SetDataBinding(Me.scheduleData, string.Empty)
    End Sub

#End Region
#region CreateAppointmentsDataTable
//Create the structure of the Appointments Table
private DataTable CreateAppointmentsDataTable()
{
	DataTable newTable = new DataTable();

	//Basic Appointment properties
	// In order to function properly, the table must contain data for 
	// Subject, StartDateTime, and EndDateTime. These three fields are 
	// required for an appointment. So all of these will have DefaultValues.
	newTable.Columns.Add("Subject", typeof(string));
	newTable.Columns["Subject"].DefaultValue = "New Appointment";
	newTable.Columns.Add("StartDateTime", typeof(DateTime));
	newTable.Columns["StartDateTime"].DefaultValue = DateTime.Now;
	newTable.Columns.Add("EndDateTime", typeof(DateTime));
	newTable.Columns["EndDateTime"].DefaultValue = DateTime.Now.AddHours(1);
	newTable.Columns.Add("Description", typeof(string));

	// All other fields are Optional.
	
	//Properties for AllDayEvents
	newTable.Columns.Add("AllDayEvent", typeof(bool));
	newTable.Columns["AllDayEvent"].DefaultValue = false;
	
	//Properties for Reminders
	newTable.Columns.Add("ReminderEnabled", typeof(bool));
	newTable.Columns["ReminderEnabled"].DefaultValue = false;
	newTable.Columns.Add("ReminderInterval", typeof(int));
	newTable.Columns.Add("ReminderUnits", typeof(int));
		
	//Properties when using owners
	newTable.Columns.Add("OwnerKey", typeof(string));

	//Properties when using recurring appointments. 
	newTable.Columns.Add("RecurrenceId", typeof(System.Guid));
	newTable.Columns.Add("Recurrence", typeof(Byte[]));
	newTable.Columns.Add("OriginalStartDateTime", typeof(DateTime));
	
	//DataKey is an extra field that can be used to link the appointment to some external data. 
	newTable.Columns.Add("DataKey", typeof(string));

	//All properties 			
	// Any other Appointment properties not covered above are stored as 
	// Binary data in the AllProperties field. This includes properties like 
	// BarColor, Location, etc. 
	newTable.Columns.Add("AllProperties", typeof(Byte[]));

	return newTable;
}
#endregion CreateAppointmentsDataTable


#region SetAppointmentBindings
//Set the Data Bindings for Appointments
private void SetAppointmentBindings()
{
	//	Get the data
	this.scheduleData.Tables.Add( this.CreateAppointmentsDataTable() );

	// Set the BindingContextControl so the component will use the same context
	// that the grid and any other controls on the form are using. 
	this.ultraCalendarInfo1.DataBindingsForAppointments.BindingContextControl = this;
 
	// Basic Appointment properties
	this.ultraCalendarInfo1.DataBindingsForAppointments.SubjectMember = "Subject";
	this.ultraCalendarInfo1.DataBindingsForAppointments.DescriptionMember = "Description";
	
	this.ultraCalendarInfo1.DataBindingsForAppointments.StartDateTimeMember = "StartDateTime";
	this.ultraCalendarInfo1.DataBindingsForAppointments.EndDateTimeMember = "EndDateTime";
	this.ultraCalendarInfo1.DataBindingsForAppointments.AllDayEventMember = "AllDayEvent";
	
	this.ultraCalendarInfo1.DataBindingsForAppointments.ReminderEnabledMember = "ReminderEnabled";
	this.ultraCalendarInfo1.DataBindingsForAppointments.ReminderIntervalMember = "ReminderInterval";
	this.ultraCalendarInfo1.DataBindingsForAppointments.ReminderUnitsMember = "ReminderUnits";

	//Properties when using owners
	this.ultraCalendarInfo1.DataBindingsForAppointments.OwnerKeyMember = "OwnerKey";
	
	//Properties when using recurring appointments. 
	this.ultraCalendarInfo1.DataBindingsForAppointments.RecurrenceIdMember = "RecurrenceId";
	this.ultraCalendarInfo1.DataBindingsForAppointments.RecurrenceMember = "Recurrence";
	this.ultraCalendarInfo1.DataBindingsForAppointments.OriginalStartDateTimeMember = "OriginalStartDateTime";

	// All other properties
	this.ultraCalendarInfo1.DataBindingsForAppointments.AllPropertiesMember = "AllProperties";

	//DataKey is an extra field that can be used to link the appointment to some external data. 
	this.ultraCalendarInfo1.DataBindingsForAppointments.DataKeyMember = "DataKey";

	// DataSource & DataMember
	this.ultraCalendarInfo1.DataBindingsForAppointments.SetDataBinding(this.scheduleData, string.Empty);
}

#endregion SetAppointmentBindings
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