Example #1
0
        private void InitializeContent()
        {
            Content = new TimePickerSelector()
            {
                BorderThickness            = Thickness.Empty,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch
            };

            BindToContent(nameof(Time));
            BindToContent(nameof(ClockIdentifier));
        }
Example #2
0
        public TimePickerFlyout()
        {
            _timeSelector = new TimePickerSelector()
            {
                BorderThickness            = Thickness.Empty,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch
            };

            Content = _timeSelector;

            this.Binding(nameof(Time), nameof(Time), Content, BindingMode.TwoWay);
            this.Binding(nameof(MinuteIncrement), nameof(MinuteIncrement), Content, BindingMode.TwoWay);
            this.Binding(nameof(ClockIdentifier), nameof(ClockIdentifier), Content, BindingMode.TwoWay);
        }
Example #3
0
        private void InitializeContent()
        {
            Content = new TimePickerSelector();
            BindToContent(nameof(Time));
            BindToContent(nameof(ClockIdentifier));

            AttachAcceptCommand((TimePickerSelector)Content);

            this.Closed += (_, __) =>
            {
                // If no accept button is explicitly part of the template, then update the set Time on light dismiss
                if (!_hasAcceptButton)
                {
                    (Content as TimePickerSelector)?.UpdateTime();
                }
            };
        }
Example #4
0
        /// <summary>
        /// This method sets the Content property of the Flyout.
        /// </summary>
        /// <remarks>
        /// Note that for performance reasons, we don't call it in the contructor. Instead, we wait for the popup to be opening.
        /// The native UIDatePicker contained in the TimePickerSelector is known for being slow in general (https://bugzilla.xamarin.com/show_bug.cgi?id=49469).
        /// Using this strategy means that a page containing a TimePicker will no longer be slowed down by this initialization during the page creation.
        /// Instead, you'll see the delay when opening the TimePickerFlyout for the first time.
        /// This is most notable on pages containing multiple TimePicker controls.
        /// </remarks>
        private void InitializeContent()
        {
            if (_isInitialized)
            {
                return;
            }

            _isInitialized = true;

            _timeSelector = new TimePickerSelector()
            {
                BorderThickness            = Thickness.Empty,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Time = Time
            };

            Content = _timeSelector;

            this.Binding(nameof(Time), nameof(Time), Content, BindingMode.TwoWay);
            this.Binding(nameof(MinuteIncrement), nameof(MinuteIncrement), Content, BindingMode.TwoWay);
            this.Binding(nameof(ClockIdentifier), nameof(ClockIdentifier), Content, BindingMode.TwoWay);
        }