using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using Xamarin.Forms;
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);
((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
{
/// <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
{