/// <summary> /// Recursive method that collects items intersecting on time, to graphically represent-them on the layout /// </summary> /// <param name="calendarItem"></param> /// <param name="items"></param> /// <param name="grouped"></param> private void CollectIntersectingGroup(CalendarItem calendarItem, List<CalendarItem> items, List<CalendarItem> grouped) { if (!grouped.Contains(calendarItem)) grouped.Add(calendarItem); foreach (CalendarItem item in items) { if (!grouped.Contains(item) && calendarItem.IntersectsWith(item.StartDate.TimeOfDay, item.EndDate.TimeOfDay)) { grouped.Add(item); CollectIntersectingGroup(item, items, grouped); } } }