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; } }
public static void UpdateMaximumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, UIDatePicker?picker) { if (picker != null) { picker.MaximumDate = datePicker.MaximumDate.ToNSDate(); } }
public static void UpdateCharacterSpacing(this MauiDatePicker nativeDatePicker, IDatePicker datePicker) { var textAttr = nativeDatePicker.AttributedText?.WithCharacterSpacing(datePicker.CharacterSpacing); if (textAttr != null) { nativeDatePicker.AttributedText = textAttr; } }
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); }
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 })); } } }
public static void UpdateFont(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, IFontManager fontManager) { var uiFont = fontManager.GetFont(datePicker.Font); nativeDatePicker.Font = uiFont; }
public static void UpdateFormat(this MauiDatePicker nativeDatePicker, IDatePicker datePicker) { nativeDatePicker.UpdateDate(datePicker, null); }
public static void UpdateMaximumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker) { nativeDatePicker.UpdateMaximumDate(datePicker, null); }
public static void UpdateFormat(this MauiDatePicker nativeDatePicker, IDatePicker datePicker) { nativeDatePicker.SetText(datePicker); }
internal static void SetText(this MauiDatePicker nativeDatePicker, IDatePicker datePicker) { nativeDatePicker.Text = datePicker.Date.ToString(datePicker.Format); }
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); }