[C] use picker creation date as default Date (#944)
* [C] use picker creation date as default Date * fix test
This commit is contained in:
Родитель
6e732fbe74
Коммит
5adab7fe4e
|
@ -162,7 +162,7 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
{
|
||||
var datePicker = new DatePicker ();
|
||||
Assert.DoesNotThrow (() => datePicker.SetValue (DatePicker.DateProperty, null));
|
||||
Assert.AreEqual (DatePicker.DateProperty.DefaultValue, datePicker.Date);
|
||||
Assert.AreEqual (DateTime.Today, datePicker.Date);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -8,8 +8,10 @@ namespace Xamarin.Forms
|
|||
{
|
||||
public static readonly BindableProperty FormatProperty = BindableProperty.Create(nameof(Format), typeof(string), typeof(DatePicker), "d");
|
||||
|
||||
public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(DatePicker), DateTime.Today, BindingMode.TwoWay, coerceValue: CoerceDate,
|
||||
propertyChanged: DatePropertyChanged);
|
||||
public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(DatePicker), default(DateTime), BindingMode.TwoWay,
|
||||
coerceValue: CoerceDate,
|
||||
propertyChanged: DatePropertyChanged,
|
||||
defaultValueCreator: (bindable) => DateTime.Today);
|
||||
|
||||
public static readonly BindableProperty MinimumDateProperty = BindableProperty.Create(nameof(MinimumDate), typeof(DateTime), typeof(DatePicker), new DateTime(1900, 1, 1),
|
||||
validateValue: ValidateMinimumDate, coerceValue: CoerceMinimumDate);
|
||||
|
|
Загрузка…
Ссылка в новой задаче