private void InitializeCurrentHourBoxes()
        {
            int row = 0;

            DateTime dateIteration = DateTime.Parse(ViewModel.SelectedDate.Value.ToString());
            var      todaysList    = new ObservableCollection <KeyValuePair <DateTime, ICalendarItem> >(
                CalendarItems.Where(x => x.Key.Year == dateIteration.Year && x.Key.Month == dateIteration.Month && x.Key.Day == dateIteration.Day));

            for (int hour = 0; hour < 24; hour++)
            {
                Dictionary <TimeSpan, ICalendarItem> CurrentDateCalendarItems = handler.GetHourItems(todaysList, dateIteration, hour, ViewModel.SelectedCalendarType);
                Dictionary <TimeSpan, ICalendarItem> tempDictionary           = new Dictionary <TimeSpan, ICalendarItem>();
                foreach (KeyValuePair <TimeSpan, ICalendarItem> obj in CurrentDateCalendarItems)
                {
                    if (obj.Key.Minutes == 0)
                    {
                        tempDictionary.Add(obj.Key, obj.Value);
                    }
                }

                CalendarDateItem calendarDateItem = CreateDateItem(hour, tempDictionary);

                SetGridLocation(calendarDateItem, row);
                CalendarDateGrid.Children.Add(calendarDateItem);
                row++;
                CalendarDateGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });

                List <int> UsedMinutes = new List <int>();
                tempDictionary = new Dictionary <TimeSpan, ICalendarItem>();
                foreach (KeyValuePair <TimeSpan, ICalendarItem> obj in CurrentDateCalendarItems.Where(x => x.Key.Minutes != 0))
                {
                    if (!UsedMinutes.Contains(obj.Key.Minutes))
                    {
                        UsedMinutes.Add(obj.Key.Minutes);
                        foreach (KeyValuePair <TimeSpan, ICalendarItem> objs in CurrentDateCalendarItems.Where(x => x.Key.Minutes == obj.Key.Minutes))
                        {
                            tempDictionary.Add(obj.Key, obj.Value);
                        }
                        CalendarDateItem tempItem = CreateDateItem(hour, tempDictionary);

                        SetGridLocation(tempItem, row);
                        CalendarDateGrid.Children.Add(tempItem);
                        row++;
                        CalendarDateGrid.RowDefinitions.Add(new RowDefinition()
                        {
                            Height = new GridLength(1, GridUnitType.Star)
                        });
                    }
                }
            }
        }
        private CalendarDateItem CreateDateItem(int hour, Dictionary <TimeSpan, ICalendarItem> dictionary)
        {
            CalendarDateItem calendarDateItem = new CalendarDateItem(new TimeSpan(0, hour, 0, 0), (Style)Application.Current.Resources["CalendarItemBox"], dictionary);

            return(calendarDateItem);
        }