Scheduler for WPF | ComponentOne
Appointments / Contacts / Assign Contacts to an Appointment
In This Topic
    Assign Contacts to an Appointment
    In This Topic

    Assigning a contact or contacts to an appointment can be done either through the Contacts dialog box at runtime or programmatically. For information on how to add items, see Add Contacts to the Contacts List.

    The contact appears next in the Contacts text box as shown in the following image.

    Assign Contact in WPF Scheduler Appointment dialog

    To assign a contact to an appointment at run time, follow these steps:

    1. Click the Contacts button in the Appointment dialog box.
    2. Select the check box next to the desired contacts and click Ok.
      Contacts dialog in WPF Scheduler

    To assign contacts to an appointment programmatically, use the following code:

    C#
    Copy Code
    //Create Appointments
    Appointment app = new Appointment(DateTime.Now.Date,DateTime.Now.Date.AddDays(1));
    app.Subject = "Meeting";
    sched1.DataStorage.AppointmentStorage.Appointments.Add(app);
    
    //Add contacts to the ContactList
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption =  "Lionel Messi" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Cristiano Ronaldo" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Xavi" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Andres Iniesta" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Zlatan Ibrahimovic" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Radamel Falcao" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Robin van Persie" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Andrea Pirlo" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "aya Toure" });
    sched1.DataStorage.ContactStorage.Contacts.Add(new Contact() { MenuCaption = "Edinson Cavani" });
    
    var appointment = sched1.DataStorage.AppointmentStorage.Appointments.First(x => x.Start == DateTime.Now.Date);
    var contactList = sched1.DataStorage.ContactStorage.Contacts;
    appointment.Links.Add(contactList.First(x => x.MenuCaption == "Cristiano Ronaldo"));
    appointment.Links.Add(contactList.First(x => x.MenuCaption == "Lionel Messi"));