Add missing document,set default value in Calendar 25/120625/2
authorSeunghyun Choi <sh4682.choi@samsung.com>
Thu, 23 Mar 2017 10:25:15 +0000 (19:25 +0900)
committerSeunghyun Choi <sh4682.choi@samsung.com>
Thu, 23 Mar 2017 10:25:57 +0000 (19:25 +0900)
 - Add missing document for event and
 - Set default value to min/max date

Change-Id: If1f0bb478b2c9daadcdd92abbf472bd8a59e65d8
Signed-off-by: Seunghyun Choi <sh4682.choi@samsung.com>
Tizen.Xamarin.Forms.Extension/CalendarView.cs

index 3935162..ffa466c 100644 (file)
@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Collections.ObjectModel;
 using Xamarin.Forms;
 
 namespace Tizen.Xamarin.Forms.Extension
@@ -20,9 +19,25 @@ namespace Tizen.Xamarin.Forms.Extension
     /// </example>
     public class CalendarView : View
     {
-        public static readonly BindableProperty MinimumDateProperty = BindableProperty.Create(nameof(MinimumDate), typeof(DateTime), typeof(CalendarView), DateTime.MinValue);
+        public static readonly BindableProperty MinimumDateProperty = BindableProperty.Create(nameof(MinimumDate), typeof(DateTime), typeof(CalendarView), new DateTime(1902, 1, 1), coerceValue: (bindable, value) =>
+        {
+            DateTime dateTime = (DateTime)value;
+            if (dateTime.Year < 1902)
+            {
+                dateTime = dateTime.AddYears(1902 - dateTime.Year);
+            }
+            return dateTime;
+        });
 
-        public static readonly BindableProperty MaximumDateProperty = BindableProperty.Create(nameof(MaximumDate), typeof(DateTime), typeof(CalendarView), DateTime.MaxValue);
+        public static readonly BindableProperty MaximumDateProperty = BindableProperty.Create(nameof(MaximumDate), typeof(DateTime), typeof(CalendarView), new DateTime(2037, 12, 31), coerceValue: (bindable, value) =>
+        {
+            DateTime dateTime = (DateTime)value;
+            if (dateTime.Year > 2037)
+            {
+                dateTime = dateTime.AddYears(2037 - dateTime.Year);
+            }
+            return dateTime;
+        });
 
         public static readonly BindableProperty FirstDayOfWeekProperty = BindableProperty.Create(nameof(FirstDayOfWeek), typeof(DayOfWeek), typeof(CalendarView), DayOfWeek.Sunday);
 
@@ -39,11 +54,15 @@ namespace Tizen.Xamarin.Forms.Extension
             ((CalendarView)bindable).SelectedDateChanged?.Invoke(bindable, new DateChangedEventArgs((DateTime)oldValue, (DateTime)newValue));
         });
 
+        /// <summary>
+        /// Occurs when a date in the Calendar is selected.
+        /// </summary>
         public event EventHandler<DateChangedEventArgs> SelectedDateChanged;
 
         /// <summary>
         /// Gets or sets the MinimumDate value.
         /// Can use only Year.
+        /// Minimum value is 1902, If the value is less than 1902, it is ignored and set to 1902
         /// </summary>
         public DateTime MinimumDate
         {
@@ -54,6 +73,7 @@ namespace Tizen.Xamarin.Forms.Extension
         /// <summary>
         /// Gets or sets the MaximumDate value.
         /// Can use only Year.
+        /// Maximum value is 2037, If the value is bigger than 2037, it is ignored and set to 2037
         /// </summary>
         public DateTime MaximumDate
         {