DateSelectorViewModel.cs 747 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using CommunityToolkit.Mvvm.ComponentModel;
  2. using CommunityToolkit.Mvvm.Input;
  3. using DialogHostAvalonia;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace InABox.Avalonia.Components.DateSelector;
  10. public partial class DateSelectorViewModel : BasePopupViewModel<DateTime?>
  11. {
  12. [ObservableProperty]
  13. private DateTime? _date;
  14. [RelayCommand]
  15. private void Cancel()
  16. {
  17. Close(null);
  18. }
  19. [RelayCommand]
  20. private void Clear()
  21. {
  22. Close(DateTime.MinValue);
  23. }
  24. [RelayCommand]
  25. private void Today()
  26. {
  27. Close(DateTime.Today);
  28. }
  29. [RelayCommand]
  30. private void Select()
  31. {
  32. Close(Date);
  33. }
  34. }