feat: add demo, fix clear button of TimeRangePicker.
This commit is contained in:
@@ -7,22 +7,9 @@ namespace Ursa.Demo.ViewModels;
|
||||
public partial class DatePickerDemoViewModel: ObservableObject
|
||||
{
|
||||
[ObservableProperty] private DateTime? _selectedDate;
|
||||
[ObservableProperty] private DateTime? _startDate;
|
||||
[ObservableProperty] private DateTime? _endDate;
|
||||
|
||||
public DatePickerDemoViewModel()
|
||||
{
|
||||
SelectedDate = DateTime.Today;
|
||||
StartDate = DateTime.Today;
|
||||
EndDate = DateTime.Today.AddDays(7);
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnPropertyChanged(e);
|
||||
if (e.PropertyName == nameof(SelectedDate))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
16
demo/Ursa.Demo/ViewModels/DateRangePickerDemoViewModel.cs
Normal file
16
demo/Ursa.Demo/ViewModels/DateRangePickerDemoViewModel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class DateRangePickerDemoViewModel: ObservableObject
|
||||
{
|
||||
[ObservableProperty] private DateTime? _startDate;
|
||||
[ObservableProperty] private DateTime? _endDate;
|
||||
|
||||
public DateRangePickerDemoViewModel()
|
||||
{
|
||||
StartDate = DateTime.Today;
|
||||
EndDate = DateTime.Today.AddDays(7);
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ public partial class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyClassInput => new ClassInputDemoViewModel(),
|
||||
MenuKeys.MenuKeyClock => new ClockDemoViewModel(),
|
||||
MenuKeys.MenuKeyDatePicker => new DatePickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyDateRangePicker => new DateRangePickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyDateTimePicker => new DateTimePickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyDialog => new DialogDemoViewModel(),
|
||||
MenuKeys.MenuKeyDisableContainer => new DisableContainerDemoViewModel(),
|
||||
@@ -75,6 +76,7 @@ public partial class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyTimeBox => new TimeBoxDemoViewModel(),
|
||||
MenuKeys.MenuKeyTimeline => new TimelineDemoViewModel(),
|
||||
MenuKeys.MenuKeyTimePicker => new TimePickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyTimeRangePicker => new TimeRangePickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyToast => new ToastDemoViewModel(),
|
||||
MenuKeys.MenuKeyToolBar => new ToolBarDemoViewModel(),
|
||||
MenuKeys.MenuKeyTreeComboBox => new TreeComboBoxDemoViewModel(),
|
||||
|
||||
@@ -53,9 +53,11 @@ public class MenuViewModel : ViewModelBase
|
||||
MenuHeader = "Date & Time", Children = new ObservableCollection<MenuItemViewModel>
|
||||
{
|
||||
new() { MenuHeader = "Date Picker", Key = MenuKeys.MenuKeyDatePicker },
|
||||
new() { MenuHeader = "Date Range Picker", Key = MenuKeys.MenuKeyDateRangePicker },
|
||||
new() { MenuHeader = "Date Time Picker", Key = MenuKeys.MenuKeyDateTimePicker },
|
||||
new() { MenuHeader = "Time Box", Key = MenuKeys.MenuKeyTimeBox },
|
||||
new() { MenuHeader = "TimePicker", Key = MenuKeys.MenuKeyTimePicker },
|
||||
new() { MenuHeader = "Time Picker", Key = MenuKeys.MenuKeyTimePicker },
|
||||
new() { MenuHeader = "Time Range Picker", Key = MenuKeys.MenuKeyTimeRangePicker },
|
||||
new() { MenuHeader = "Clock", Key = MenuKeys.MenuKeyClock }
|
||||
}
|
||||
},
|
||||
@@ -108,6 +110,7 @@ public static class MenuKeys
|
||||
public const string MenuKeyClassInput = "Class Input";
|
||||
public const string MenuKeyClock = "Clock";
|
||||
public const string MenuKeyDatePicker = "DatePicker";
|
||||
public const string MenuKeyDateRangePicker = "DateRangePicker";
|
||||
public const string MenuKeyDateTimePicker = "DateTimePicker";
|
||||
public const string MenuKeyDialog = "Dialog";
|
||||
public const string MenuKeyDisableContainer = "DisableContainer";
|
||||
@@ -142,6 +145,7 @@ public static class MenuKeys
|
||||
public const string MenuKeyTimeBox = "TimeBox";
|
||||
public const string MenuKeyTimeline = "Timeline";
|
||||
public const string MenuKeyTimePicker = "TimePicker";
|
||||
public const string MenuKeyTimeRangePicker = "TimeRangePicker";
|
||||
public const string MenuKeyToast = "Toast";
|
||||
public const string MenuKeyToolBar = "ToolBar";
|
||||
public const string MenuKeyTreeComboBox = "TreeComboBox";
|
||||
|
||||
@@ -6,13 +6,9 @@ namespace Ursa.Demo.ViewModels;
|
||||
public partial class TimePickerDemoViewModel: ObservableObject
|
||||
{
|
||||
[ObservableProperty] private TimeSpan? _time;
|
||||
[ObservableProperty] private TimeSpan? _startTime;
|
||||
[ObservableProperty] private TimeSpan? _endTime;
|
||||
|
||||
|
||||
public TimePickerDemoViewModel()
|
||||
{
|
||||
Time = new TimeSpan(12, 20, 0);
|
||||
StartTime = new TimeSpan(8, 21, 0);
|
||||
EndTime = new TimeSpan(18, 22, 0);
|
||||
}
|
||||
}
|
||||
16
demo/Ursa.Demo/ViewModels/TimeRangePickerDemoViewModel.cs
Normal file
16
demo/Ursa.Demo/ViewModels/TimeRangePickerDemoViewModel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class TimeRangePickerDemoViewModel: ObservableObject
|
||||
{
|
||||
[ObservableProperty] private TimeSpan? _startTime;
|
||||
[ObservableProperty] private TimeSpan? _endTime;
|
||||
|
||||
public TimeRangePickerDemoViewModel()
|
||||
{
|
||||
StartTime = new TimeSpan(8, 21, 0);
|
||||
EndTime = new TimeSpan(18, 22, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user