Scheduler for WPF | ComponentOne
Appointments / Contacts / Add Contacts to the Contacts List
In This Topic
    Add Contacts to the Contacts List
    In This Topic

    Scheduler supports contacts created at run time through the Contacts dialog box. Once added to the list, the contact can be assigned to an appointment.

    Add Contacts in WPF Scheduler Appointment Dialog

    To add a contact at run time:

    1. Add a new or open an existing appointment.
    2. Click the Contacts button in the Appointment dialog box. The Contacts dialog box appears.
    3. Enter a name in the Available text box and click Add.
    4. Click Ok to close the Contacts dialog box.

     To add contacts programmatically in the Appointment dialog, use the following code:

    C#
    Copy Code
    ObservableCollection<string> contacts = new ObservableCollection<string>();
    private void Add_Contacts(object sender, RoutedEventArgs e)
    {
        contacts.Add("Lionel Messi");
        contacts.Add("Cristiano Ronaldo");
        contacts.Add("Xavi");
        contacts.Add("Andres Iniesta");
        contacts.Add("Zlatan Ibrahimovic");
        contacts.Add("Radamel Falcao");
        contacts.Add("Robin van Persie");
        contacts.Add("Andrea Pirlo");
        contacts.Add("aya Toure");
        contacts.Add("Edinson Cavani");
    
        foreach (string contact in contacts)
        {
            Contact cnt = new Contact();
            cnt.MenuCaption = contact;
            if (!sched1.DataStorage.ContactStorage.Contacts.Any(x => x.MenuCaption == contact))
                sched1.DataStorage.ContactStorage.Contacts.Add(cnt);
        }
    }