Exemple #1
0
        public static void UpdateTextColor(this TimePicker platformTimePicker, ITimePicker timePicker)
        {
            Color textColor = timePicker.TextColor;

            UI.Xaml.Media.Brush?brush = textColor?.ToPlatform();

            if (brush is null)
            {
                platformTimePicker.Resources.Remove("TimePickerButtonForeground");
                platformTimePicker.Resources.Remove("TimePickerButtonForegroundPointerOver");
                platformTimePicker.Resources.Remove("TimePickerButtonForegroundPressed");
                platformTimePicker.Resources.Remove("TimePickerButtonForegroundDisabled");

                platformTimePicker.ClearValue(TimePicker.ForegroundProperty);
            }
            else
            {
                platformTimePicker.Resources["TimePickerButtonForeground"]            = brush;
                platformTimePicker.Resources["TimePickerButtonForegroundPointerOver"] = brush;
                platformTimePicker.Resources["TimePickerButtonForegroundPressed"]     = brush;
                platformTimePicker.Resources["TimePickerButtonForegroundDisabled"]    = brush;

                platformTimePicker.Foreground = brush;
            }
        }
        public virtual void ShouldBeAbleToClearValue()
        {
            TimePicker tip = new TimePicker();

            bool executed = false;
            bool loaded = false;

            tip.Loaded += (sender, args) => loaded = true;

            tip.LayoutUpdated += (sender, args) =>
            {
                if (executed)
                {
                    return;
                }
                executed = true;
                tip.Value = new DateTime();
                tip.ClearValue(TimePicker.ValueProperty);
                Assert.IsTrue(DependencyProperty.UnsetValue == tip.ReadLocalValue(TimePicker.ValueProperty));
            };

            EnqueueCallback(() => TestPanel.Children.Add(tip));
            EnqueueConditional(() => loaded);
            EnqueueCallback(() => executed = false);
            EnqueueCallback(tip.UpdateLayout);
            EnqueueConditional(() => executed);
            EnqueueTestComplete();
        }
        public virtual void ShouldRevertToOriginalPopupAfterClearing()
        {
            TimePicker tp = new TimePicker();

            TimePickerPopup original = null;

            TestAsync(
                    tp,
                    () => original = tp.Popup,
                    () => tp.Popup = new ListTimePickerPopup(),
                    () => tp.ClearValue(TimePicker.PopupProperty),
                    () => Assert.AreEqual(original, tp.Popup));
        }
Exemple #4
0
 private void ClearValue_Click(object sender, RoutedEventArgs e)
 {
     TimePicker.ClearValue(TimePickerBase.SelectedDateTimeProperty);
 }