public static double ItemCount(CalendarAppointmentItem currentApp, UIElementCollection children) { double count = 0; foreach (UIElement child in children) { if (child is CalendarAppointmentItem) { var currentChild = child as CalendarAppointmentItem; var cStart = currentApp.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?; var cEnd = currentApp.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?; var toTest = new DateRange(cStart.Value, cEnd.Value); var aStart = currentChild.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?; var aEnd = currentChild.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?; var current = new DateRange(aStart.Value, aEnd.Value); if (toTest.Overlaps(current)) { count++; } } } return count; }
public static double ItemCount(CalendarAppointmentItem currentApp, UIElementCollection children) { double count = 0; foreach (UIElement child in children) { if (child is CalendarAppointmentItem) { var currentChild = child as CalendarAppointmentItem; var cStart = currentApp.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?; var cEnd = currentApp.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?; var toTest = new DateRange(cStart.Value, cEnd.Value); var aStart = currentChild.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?; var aEnd = currentChild.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?; var current = new DateRange(aStart.Value, aEnd.Value); if (toTest.Overlaps(current)) { count++; } } } return(count); }
private double GetWidth(Size finalSize, CalendarAppointmentItem appointementItem) { double count = Overlapping.ItemCount(appointementItem, this.Children); return (double)(finalSize.Width / count); }
private double GetWidth(Size finalSize, CalendarAppointmentItem appointementItem) { double count = Overlapping.ItemCount(appointementItem, this.Children); return((double)(finalSize.Width / count)); }