Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ousiax committed Dec 12, 2023
1 parent cdf43ea commit 8edaf4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Leo.Wpf.App/ViewModels/NewCustomerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,26 @@ public partial class NewCustomerViewModel(
[NotifyCanExecuteChangedFor(nameof(SaveCommand))]
private string? _name;

[Required]
[Phone]
[NotifyDataErrorInfo]
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(SaveCommand))]
private string? _phone;

[Required]
[EnumDataType(typeof(Gender))]
[NotifyDataErrorInfo]
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(SaveCommand))]
private string? _gender;

[Required]
[DataType(DataType.Date)]
[NotifyDataErrorInfo]
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(SaveCommand))]
private DateOnly? _birthday;
private DateTime? _birthday; // DateOnly

[Required(AllowEmptyStrings = false)]
[NotifyDataErrorInfo]
Expand Down
2 changes: 1 addition & 1 deletion src/Leo.Wpf.App/Views/NewCustomerWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Label Content="{StaticResource NewCustomerWindow.Label.Birthday.Content}" />
<DatePickerTextBox
x:Name="txtBirthday"
Text="{Binding Birthday, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, StringFormat={StaticResource NewCustomerWindow.Label.Birthday.StringFormat}}"/>
Text="{Binding Birthday, ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus, StringFormat={StaticResource NewCustomerWindow.Label.Birthday.StringFormat}}"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal">
<Label Content="{StaticResource NewCustomerWindow.Label.Gender.Content}" />
Expand Down

0 comments on commit 8edaf4d

Please sign in to comment.