Exemplo n.º 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;
     }
 }
Exemplo n.º 2
0
 public static void UpdateMaximumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, UIDatePicker?picker)
 {
     if (picker != null)
     {
         picker.MaximumDate = datePicker.MaximumDate.ToNSDate();
     }
 }
Exemplo n.º 3
0
        public static void UpdateCharacterSpacing(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
        {
            var textAttr = nativeDatePicker.AttributedText?.WithCharacterSpacing(datePicker.CharacterSpacing);

            if (textAttr != null)
            {
                nativeDatePicker.AttributedText = textAttr;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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 }));
                }
            }
        }
Exemplo n.º 8
0
        public static void UpdateFont(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, IFontManager fontManager)
        {
            var uiFont = fontManager.GetFont(datePicker.Font);

            nativeDatePicker.Font = uiFont;
        }
Exemplo n.º 9
0
 public static void UpdateFormat(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.UpdateDate(datePicker, null);
 }
Exemplo n.º 10
0
 public static void UpdateMaximumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.UpdateMaximumDate(datePicker, null);
 }
Exemplo n.º 11
0
 public static void UpdateFormat(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.SetText(datePicker);
 }
Exemplo n.º 12
0
 internal static void SetText(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
 {
     nativeDatePicker.Text = datePicker.Date.ToString(datePicker.Format);
 }
Exemplo n.º 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);
 }