Exemple #1
0
 public static void UpdateMaximumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, DatePickerDialog?datePickerDialog)
 {
     if (datePickerDialog != null)
     {
         datePickerDialog.DatePicker.MaxDate = (long)datePicker.MaximumDate.ToUniversalTime().Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds;
     }
 }
Exemple #2
0
 public static void UpdateMaximumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, UIDatePicker?picker)
 {
     if (picker != null)
     {
         picker.MaximumDate = datePicker.MaximumDate.ToNSDate();
     }
 }
Exemple #3
0
        public static void UpdateCharacterSpacing(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
        {
            var textAttr = nativeDatePicker.AttributedText?.WithCharacterSpacing(datePicker.CharacterSpacing);

            if (textAttr != null)
            {
                nativeDatePicker.AttributedText = textAttr;
            }
        }
Exemple #4
0
        public static void UpdateDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, UIDatePicker?picker)
        {
            if (picker != null && picker.Date.ToDateTime().Date != datePicker.Date.Date)
            {
                picker.SetDate(datePicker.Date.ToNSDate(), false);
            }

            nativeDatePicker.Text = datePicker.Date.ToString(datePicker.Format);
        }
Exemple #5
0
        public static void UpdateFont(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, IFontManager fontManager)
        {
            var font = datePicker.Font;

            var tf = fontManager.GetTypeface(font);

            nativeDatePicker.Typeface = tf;

            var sp = fontManager.GetScaledPixel(font);

            nativeDatePicker.SetTextSize(ComplexUnitType.Sp, sp);
        }
        public static void UpdateTextColor(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, UIColor?defaultTextColor)
        {
            var textColor = datePicker.TextColor;

            if (textColor == null)
            {
                nativeDatePicker.TextColor = defaultTextColor;
            }
            else
            {
                nativeDatePicker.TextColor = textColor.ToNative();
            }

            // HACK This forces the color to update; there's probably a more elegant way to make this happen
            nativeDatePicker.UpdateDate(datePicker);
        }
        public static void UpdateTextColor(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, ColorStateList?defaultTextColor)
        {
            var textColor = datePicker.TextColor;

            if (textColor == null)
            {
                if (defaultTextColor != null)
                {
                    nativeDatePicker.SetTextColor(defaultTextColor);
                }
            }
            else
            {
                var androidColor = textColor.ToNative();

                if (!nativeDatePicker.TextColors.IsOneColor(ColorStates, androidColor))
                {
                    var acolor = androidColor.ToArgb();
                    nativeDatePicker.SetTextColor(new ColorStateList(ColorStates, new[] { acolor, acolor }));
                }
            }
        }
Exemple #8
0
        public static void UpdateFont(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, IFontManager fontManager)
        {
            var uiFont = fontManager.GetFont(datePicker.Font);

            nativeDatePicker.Font = uiFont;
        }
Exemple #9
0
 public static void UpdateFormat(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.UpdateDate(datePicker, null);
 }
Exemple #10
0
 public static void UpdateMaximumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.UpdateMaximumDate(datePicker, null);
 }
Exemple #11
0
 public static void UpdateFormat(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.SetText(datePicker);
 }
Exemple #12
0
 internal static void SetText(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.Text = datePicker.Date.ToString(datePicker.Format);
 }
Exemple #13
0
 public static void UpdateCharacterSpacing(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.LetterSpacing = datePicker.CharacterSpacing.ToEm();
 }
 public static void UpdateTextColor(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.UpdateTextColor(datePicker, null);
 }