示例#1
0
        private void UpdateTotalHeight()
        {
            nfloat totalHeight;

            if (_stackViewHolidays.ArrangedSubviews.Length > 0)
            {
                int count = _stackViewHolidays.ArrangedSubviews.Length;
                totalHeight = _timetableHeight + UIMainCalendarItemView.GetHeight() * count + count - 1; // plus count - 1 for the spacing between items
            }
            else
            {
                totalHeight = _timetableHeight;
            }

            if (totalHeight > 0)
            {
                totalHeight += 32; // Compensate for the padding we add outside
            }

            this.Frame = new CoreGraphics.CGRect(
                x: this.Frame.X,
                y: this.Frame.Y,
                width: this.Frame.Width,
                height: totalHeight);
            if (this.Superview is UITableView)
            {
                // To make the table view actually refresh, we have to set this
                (this.Superview as UITableView).TableFooterView = this;
            }
        }
示例#2
0
        private UIView CreateAllDayItemView(object obj)
        {
            // Last item is a blank view that'll act as the "fill remaining space" so the previous item doesn't stretch its height
            if (obj is string)
            {
                return(new UIView());
            }

            var view = new UIMainCalendarItemView()
            {
                DataContext = obj
            };

            return(view);
        }
        private void AddSingleFullItemView(UIStackView stackView, BaseViewItemHomeworkExam item)
        {
            var view = new UIMainCalendarItemView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                DataContext = item,

                // After opened, we hide this popup, otherwise when the user presses back, it'll close the popup rather than the homework
                // Ideally we would implement the back handling as part of the view model like we did for UWP, but for simplicity we're going
                // to leave it like this for now
                AfterOpenedHomeworkAction = delegate { HideFull(); }
            };

            stackView.AddArrangedSubview(view);
            view.StretchWidth(stackView);
        }