12 BindableProperty.Create(nameof(
Font), typeof(Microsoft.Maui.Font), typeof(
ExtendedDatePicker),
new Microsoft.Maui.Font());
19 propertyChanged: DatePropertyChanged);
50 public Microsoft.Maui.Font
Font
52 get {
return (Microsoft.Maui.Font)this.GetValue(
FontProperty); }
114 this.SetDefaultDate();
122 static void DatePropertyChanged(BindableObject bindable,
object oldValue,
object newValue)
127 selected?.Invoke(Picker,
new NullableDateChangedEventArgs((DateTime?)oldValue, (DateTime?)newValue));
130 private bool isDefaultDateSet =
false;
135 base.OnPropertyChanged(propertyName);
137 if (propertyName == IsFocusedProperty.PropertyName)
147 if (propertyName == DateProperty.PropertyName && !
this.isDefaultDateSet)
149 this.NullableDate = this.Date;
161 private void UpdateDate()
169 this.isDefaultDateSet =
true;
170 this.SetDefaultDate();
171 this.isDefaultDateSet =
false;
175 private void SetDefaultDate()
177 DateTime now = DateTime.Now;
178 this.Date =
new DateTime(now.Year, now.Month, now.Day);
Extended DatePicker for nullable values with text placeholder
static readonly BindableProperty PlaceholderTextColorProperty
The PlaceholderTextColor property
bool HasBorder
Gets or sets if the border should be shown or not
Microsoft.Maui.Font Font
Gets or sets the Font
static readonly BindableProperty XAlignProperty
The XAlign property
static readonly BindableProperty NullableDateProperty
The NullableDate property
string Placeholder
Get or sets the PlaceHolder
override void OnPropertyChanged(string? propertyName=null)
static readonly BindableProperty PlaceholderProperty
The Placeholder property
TextAlignment XAlign
Gets or sets the X alignment of the text
EventHandler< NullableDateChangedEventArgs >? NullableDateSelected
Event sent when the date is changed.
ExtendedDatePicker()
Creates a new instance of the ExtendedDatePicker class.
DateTime? NullableDate
Get or sets the NullableDate
Color PlaceholderTextColor
Sets color for placeholder text
static readonly BindableProperty FontProperty
The font property
static readonly BindableProperty HasBorderProperty
The HasBorder property