diff --git a/UI/Controls/Select/DateSelect.cs b/UI/Controls/Select/DateSelect.cs index 3fef81b..ca42cd7 100644 --- a/UI/Controls/Select/DateSelect.cs +++ b/UI/Controls/Select/DateSelect.cs @@ -152,6 +152,7 @@ private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChan public Command ShowSelectCommand { get; set; } public Command SetYearCommand { get; set; } public Command SetMonthCommand { get; set; } + public Command SwitchDateCommand { get; set; } public Command DoneCommand { get; set; } private bool IsFirstClick = false; @@ -164,6 +165,7 @@ public DateSelect() ShowSelectCommand = new Command(new Action(OnShowSelect)); SetYearCommand = new Command(new Action(OnSetYear)); SetMonthCommand = new Command(new Action(OnSetMonth)); + SwitchDateCommand = new Command(new Action(OnSwitchDate)); DoneCommand = new Command(new Action(OnDone)); @@ -249,6 +251,30 @@ private void OnDone(object obj) IsOpen = false; } + private void OnSwitchDate(object obj) + { + var newDate = Day != null ? Day.Day : new DateTime(Year, Month, 1); + if (SelectType == DateSelectType.Day) + { + newDate = newDate.AddDays(int.Parse(obj.ToString())); + } + else if (SelectType == DateSelectType.Month) + { + newDate = newDate.AddMonths(int.Parse(obj.ToString())); + } + else if (SelectType == DateSelectType.Year) + { + newDate = newDate.AddYears(int.Parse(obj.ToString())); + } + Year = newDate.Year; + Month = newDate.Month; + Date = newDate; + SelectedDay = newDate; + + UpdateDays(); + UpdateDateStr(); + } + private void OnSetMonth(object obj) { int newMonth = Month + int.Parse(obj.ToString()); diff --git a/UI/Themes/Select/DateSelect.xaml b/UI/Themes/Select/DateSelect.xaml index b16ab1c..b086537 100644 --- a/UI/Themes/Select/DateSelect.xaml +++ b/UI/Themes/Select/DateSelect.xaml @@ -22,16 +22,20 @@ - - - - - - - - - - + + + + + + + + + + + + + +