Scheduler for WinForms | ComponentOne
Scheduler Control / Appointments / Categories / Assigning Predefined Categories to an Appointment
In This Topic
    Assigning Predefined Categories to an Appointment
    In This Topic

    Categories can be assigned in code or at run time through the Categories dialog box. The following code, added to the Form_Load event, assign the Strategies category to an appointment:

    C#
    Copy Code
    C1.C1Schedule.Appointment app;
    app = this.c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add();
    // Set some details for the appointment.    
    app.Subject = "Meeting";
    app.Location = "Large Conference Room";
    app.Duration = TimeSpan.FromMinutes(45);
    app.Start = new DateTime(2021, 11, 01, 13, 30, 0);
    // Assign a predefined label to the appointment.         
    app.Label = this.c1Schedule1.DataStorage.LabelStorage.Labels[6];
    // Assign a predefined availability to the appointment.           
    app.BusyStatus = this.c1Schedule1.DataStorage.StatusStorage.Statuses[C1.C1Schedule.StatusTypeEnum.Tentative];
    // Assign a category to the appointment.         
    C1.C1Schedule.Category category;
    category = this.c1Schedule1.DataStorage.CategoryStorage.Categories[15];
    app.Categories.Add(category);
    

    At run time, assigning a category or categories to an appointment can be done through the Categories dialog box. Clicking the Categories button in the Appointment dialog box opens the Categories dialog box.

    In the Categories dialog box, you can check the categories you would like to add to the appointment.