public static void UpdateMaximumDate(this MauiDatePicker platformDatePicker, IDatePicker datePicker, UIDatePicker?picker) { if (picker != null) { picker.MaximumDate = datePicker.MaximumDate.ToNSDate(); } }
public static void UpdateMaximumDate(this MauiDatePicker platformDatePicker, IDatePicker datePicker, DatePickerDialog?datePickerDialog) { if (datePickerDialog != null) { datePickerDialog.DatePicker.MaxDate = (long)datePicker.MaximumDate.ToUniversalTime().Subtract(DateTime.MinValue.AddYears(1969)).TotalMilliseconds; } }
public static void UpdateMinimumDate(this MauiDatePicker nativeDatePicker, IDatePicker datePicker, UIDatePicker?picker) { if (picker != null) { picker.MinimumDate = datePicker.MinimumDate.ToNSDate(); } }
public static void UpdateDate(this MauiDatePicker platformDatePicker, IDatePicker datePicker, UIDatePicker?picker) { if (picker != null && picker.Date.ToDateTime().Date != datePicker.Date.Date) { picker.SetDate(datePicker.Date.ToNSDate(), false); } platformDatePicker.Text = datePicker.Date.ToString(datePicker.Format); platformDatePicker.UpdateCharacterSpacing(datePicker); }
public static void UpdateTextColor(this MauiDatePicker platformDatePicker, IDatePicker datePicker) { var textColor = datePicker.TextColor; if (textColor != null) { if (PlatformInterop.CreateEditTextColorStateList(platformDatePicker.TextColors, textColor.ToPlatform()) is ColorStateList c) { platformDatePicker.SetTextColor(c); } } }
public static void UpdateTextColor(this MauiDatePicker platformDatePicker, IDatePicker datePicker) { var textColor = datePicker.TextColor; if (textColor != null) { var androidColor = textColor.ToPlatform(); if (!platformDatePicker.TextColors.IsOneColor(ColorStates.EditText, androidColor)) { platformDatePicker.SetTextColor(ColorStateListExtensions.CreateEditText(androidColor)); } } }
public static void UpdateTextColor(this MauiDatePicker platformDatePicker, IDatePicker datePicker, UIColor?defaultTextColor) { var textColor = datePicker.TextColor; if (textColor == null) { platformDatePicker.TextColor = defaultTextColor; } else { platformDatePicker.TextColor = textColor.ToPlatform(); } // HACK This forces the color to update; there's probably a more elegant way to make this happen platformDatePicker.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.EditText, androidColor)) { nativeDatePicker.SetTextColor(ColorStateListExtensions.CreateEditText(androidColor)); } } }
public static void UpdateDate(this MauiDatePicker platformDatePicker, IDatePicker datePicker, UIDatePicker?picker) { if (picker != null && picker.Date.ToDateTime().Date != datePicker.Date.Date) { picker.SetDate(datePicker.Date.ToNSDate(), false); } string format = datePicker.Format ?? string.Empty; // Can't use VirtualView.Format because it won't display the correct format if the region and language are set differently if (picker != null && string.IsNullOrWhiteSpace(format) || format.Equals("d", StringComparison.OrdinalIgnoreCase)) { NSDateFormatter dateFormatter = new NSDateFormatter { TimeZone = NSTimeZone.FromGMT(0) }; if (format.Equals("D", StringComparison.Ordinal) == true) { dateFormatter.DateStyle = NSDateFormatterStyle.Long; var strDate = dateFormatter.StringFor(picker?.Date); platformDatePicker.Text = strDate; } else { dateFormatter.DateStyle = NSDateFormatterStyle.Short; var strDate = dateFormatter.StringFor(picker?.Date); platformDatePicker.Text = strDate; } } else if (format.Contains('/', StringComparison.Ordinal)) { platformDatePicker.Text = datePicker.Date.ToString(format, CultureInfo.InvariantCulture); } else { platformDatePicker.Text = datePicker.Date.ToString(format); } platformDatePicker.UpdateCharacterSpacing(datePicker); }
public static void UpdateFormat(this MauiDatePicker platformDatePicker, IDatePicker datePicker) { platformDatePicker.SetText(datePicker); }
internal static void SetText(this MauiDatePicker platformDatePicker, IDatePicker datePicker) { platformDatePicker.Text = datePicker.Date.ToString(datePicker.Format); }
public static void UpdateTextAlignment(this MauiDatePicker nativeDatePicker, IDatePicker datePicker) { // TODO: Update TextAlignment based on the EffectiveFlowDirection property. }
public static void UpdateMaximumDate(this MauiDatePicker platformDatePicker, IDatePicker datePicker, UIDatePicker?picker) { picker?.UpdateMaximumDate(datePicker); }
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); }
public static void UpdateMaximumDate(this MauiDatePicker platformDatePicker, IDatePicker datePicker) { platformDatePicker.UpdateMaximumDate(datePicker, null); }
public static void UpdateTextColor(this MauiDatePicker platformDatePicker, IDatePicker datePicker) => UpdateTextColor(platformDatePicker, datePicker, null);
public static void UpdateFormat(this MauiDatePicker platformDatePicker, IDatePicker datePicker) { platformDatePicker.UpdateDate(datePicker, null); }
public static void UpdateTextColor(this MauiDatePicker nativeDatePicker, IDatePicker datePicker) { nativeDatePicker.UpdateTextColor(datePicker, null); }