protected override FrameworkElement GenerateContent(DayScheduleItemsArranger.EventItem item)
        {
            var grid = new Grid();

            var rectangle = new Rectangle()
            {
                RadiusX = 12,
                RadiusY = 12,
                Fill    = MyCollapsedEventItem.GetBackgroundBrush(item.Item)
            };

            grid.Children.Add(rectangle);

            var tb = new TextBlock()
            {
                Foreground = Brushes.White,
                Margin     = new Windows.UI.Xaml.Thickness(6, 6, 0, 0),
                Text       = item.Item.Name
            };

            if (item.Item.IsComplete)
            {
                TextBlockCompat.SetStrikethrough(tb, true);
            }
            grid.Children.Add(tb);

            return(grid);
        }
        private void render()
        {
            _schedulesGrid.Children.Clear();
            _schedulesGrid.RowDefinitions.Clear();

            if (Classes == null || Date == DateTime.MinValue || !ViewModel.Semester.IsDateDuringThisSemester(Date))
            {
                UpdateVisibility();
                return;
            }

            if (!_arrangedItems.IsValid())
            {
                UpdateVisibility();
                return;
            }

            base.Visibility = Visibility.Visible;

            //put in the vertical gap divider
            Rectangle verticalGap = new Rectangle()
            {
                Fill = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"])
            };

            Grid.SetColumn(verticalGap, 1);
            Grid.SetRowSpan(verticalGap, int.MaxValue);
            _schedulesGrid.Children.Add(verticalGap);

            var hourFormatter = new DateTimeFormatter("{hour.integer}");

            for (TimeSpan time = _arrangedItems.StartTime; time <= _arrangedItems.EndTime; time = time.Add(TimeSpan.FromHours(1)))
            {
                _schedulesGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(TIME_INDICATOR_SIZE)
                });

                TextBlock hour = new TextBlock()
                {
                    Text                = hourFormatter.Format(DateTime.Today.Add(time)),
                    FontSize            = 26,
                    VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center,
                    HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                    FontWeight          = FontWeights.Light
                };
                Grid.SetRow(hour, _schedulesGrid.RowDefinitions.Count - 1);
                _schedulesGrid.Children.Add(hour);

                //if not last row, add the divider
                if (time + TimeSpan.FromHours(1) <= _arrangedItems.EndTime)
                {
                    _schedulesGrid.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new GridLength(GAP_SIZE)
                    });

                    Rectangle gap = new Rectangle()
                    {
                        Fill = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"])
                    };
                    Grid.SetRow(gap, _schedulesGrid.RowDefinitions.Count - 1);
                    Grid.SetColumnSpan(gap, 3);
                    _schedulesGrid.Children.Add(gap);
                }
            }

            foreach (var s in _arrangedItems.ScheduleItems)
            {
                MyScheduleItem visual = new MyScheduleItem(s.Item);

                AddVisualItem(visual, s);
            }

            // Reverse the order so that when items expand, they appear on top of the items beneath them.
            // Otherwise I would have to do some crazy Z-order logic.
            foreach (var e in _arrangedItems.EventItems.Reverse())
            {
                FrameworkElement visual;
                if (e.IsCollapsedMode)
                {
                    visual = new MyCollapsedEventItem()
                    {
                        Item = e
                    };
                }
                else
                {
                    visual = new MyFullEventItem()
                    {
                        Item = e
                    };
                }

                AddVisualItem(visual, e);
            }
        }