using CommunityToolkit.Mvvm.Input; namespace WorkTime.Mobile.Pages.Components; public partial class DateSelector : ContentView { public static readonly BindableProperty CurrentDateProperty = BindableProperty.Create( nameof(CurrentDate), typeof(DateTime), typeof(DateSelector), DateTime.Now); public static readonly BindableProperty MaxDateProperty = BindableProperty.Create( nameof(MaxDate), typeof(DateTime), typeof(DateSelector), DateTime.Now); public static readonly BindableProperty CommandProperty = BindableProperty.Create( nameof(Command), typeof(IRelayCommand), typeof(DateSelector)); public DateTime CurrentDate { get => (DateTime)GetValue(CurrentDateProperty); set => SetValue(CurrentDateProperty, value); } public DateTime MaxDate { get => (DateTime)GetValue(MaxDateProperty); set => SetValue(MaxDateProperty, value); } public IRelayCommand? Command { get => (IRelayCommand)GetValue(CommandProperty); set => SetValue(CommandProperty, value); } public DateSelector() { InitializeComponent(); } private void OnDateSelected(object? sender, DateChangedEventArgs e) { var date = DateOnly.FromDateTime(CurrentDate); Command?.Execute(date); } }