Nevron Open Vision Documentation
Grouping Appointments

Grouping appointments is the process of assigning one or more pairs of group name and group item to an appointment.

Grouping Example

The grouping information is used by the schedule to place the appointment at a proper place in the schedule grid as the following image demonstrates:

Sample Code

This example starts by creating and adding a schedule group to the schedule:

Create and add a schedule group
Copy Code
const string ActivityGroup = "Activity";
const string Work = "Work";
const string Rest = "Rest";
const string Travel = "Travel";

// Add a schedule group
schedule.Groups.Add(new NScheduleGroup(ActivityGroup, new string[] { Work, Rest, Travel }));

Then a schedule group grouping is added to the day view mode of the schedule:

Add a schedule group grouping
Copy Code
schedule.DayViewMode.Groupings.Add(new NGroupGrouping(ActivityGroup));
Note that the order of the groupings determine the way they are displayed in the header and the way the appointments are grouped. If you want the schedule group grouping to be before the default day grouping of the day view mode, use the Insert method instead of the Add method of the view mode grouping collection.

Finally you should create some appointments, associate them with an item from the group and add them to the schedule:

Create and group appointments
Copy Code
// Create some appointments
DateTime today = DateTime.Today;
schedule.Appointments.Add(CreateAppointment("Travel to Work", today.AddHours(6.5), today.AddHours(7.5), Travel));
schedule.Appointments.Add(CreateAppointment("Meeting with John", today.AddHours(8), today.AddHours(10), Work));
schedule.Appointments.Add(CreateAppointment("Conference", today.AddHours(10.5), today.AddHours(11.5), Work));
schedule.Appointments.Add(CreateAppointment("Lunch", today.AddHours(12), today.AddHours(14), Rest));
schedule.Appointments.Add(CreateAppointment("News Reading", today.AddHours(12.5), today.AddHours(13.5), Rest));
schedule.Appointments.Add(CreateAppointment("Video Presentation", today.AddHours(14.5), today.AddHours(15.5), Work));
schedule.Appointments.Add(CreateAppointment("Web Meeting", today.AddHours(16), today.AddHours(17), Work));
schedule.Appointments.Add(CreateAppointment("Travel back home", today.AddHours(17.5), today.AddHours(19), Travel));
schedule.Appointments.Add(CreateAppointment("Family Dinner", today.AddHours(20), today.AddHours(21), Rest));

private NAppointment CreateAppointment(string subject, DateTime start, DateTime end, string groupItem)
{
    NAppointment appointment = new NAppointment(subject, start, end);
    appointment.Groups = new NAppointmentGroupCollection();
    appointment.Groups.Add(new NAppointmentGroup("Activity", groupItem));
    return appointment;
}
See Also
Send Feedback