Skip to content

Commit f8ddb3d

Browse files
committed
Add phone number field
1 parent cccf8a0 commit f8ddb3d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

samples/MvvmSample.Core/ViewModels/ObservableValidatorPageViewModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public ObservableForm(IDialogService dialogService)
5050
[EmailAddress]
5151
private string? email;
5252

53+
[ObservableProperty]
54+
[Required]
55+
[Phone]
56+
private string? phoneNumber;
57+
5358
[ICommand]
5459
private void Submit()
5560
{

samples/MvvmSampleUwp/MvvmSampleUwp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<AssemblyName>MvvmSampleUwp</AssemblyName>
1212
<DefaultLanguage>en-US</DefaultLanguage>
1313
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
14-
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
14+
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.22000.0</TargetPlatformVersion>
1515
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
1616
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
1717
<FileAlignment>512</FileAlignment>

samples/MvvmSampleUwp/Views/ObservableValidatorPage.xaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,34 @@
1616
Width="560"
1717
HorizontalAlignment="Left"
1818
Header="Enter your first:"
19+
InputScope="NameOrPhoneNumber"
1920
IsSpellCheckEnabled="False"
2021
PlaceholderText="First name"
2122
Text="{x:Bind ViewModel.Form.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
2223
<TextBox
2324
Width="560"
2425
HorizontalAlignment="Left"
2526
Header="Enter your last name:"
27+
InputScope="NameOrPhoneNumber"
2628
IsSpellCheckEnabled="False"
2729
PlaceholderText="Last name"
2830
Text="{x:Bind ViewModel.Form.LastName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
2931
<TextBox
3032
Width="560"
3133
HorizontalAlignment="Left"
3234
Header="Enter your email address:"
35+
InputScope="EmailNameOrAddress"
3336
IsSpellCheckEnabled="False"
3437
PlaceholderText="Email"
3538
Text="{x:Bind ViewModel.Form.Email, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
39+
<TextBox
40+
Width="560"
41+
HorizontalAlignment="Left"
42+
Header="Enter your phone number:"
43+
InputScope="NameOrPhoneNumber"
44+
IsSpellCheckEnabled="False"
45+
PlaceholderText="Phone number"
46+
Text="{x:Bind ViewModel.Form.PhoneNumber, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
3647

3748
<Button Command="{x:Bind ViewModel.Form.SubmitCommand}" Content="Submit" />
3849

@@ -62,7 +73,7 @@
6273
Message="The form was filled in with some errors."
6374
Severity="Error">
6475
<muxc:InfoBar.ActionButton>
65-
<Button Content="Show errors" Command="{x:Bind ViewModel.Form.ShowErrorsCommand}" />
76+
<Button Command="{x:Bind ViewModel.Form.ShowErrorsCommand}" Content="Show errors" />
6677
</muxc:InfoBar.ActionButton>
6778
<interactivity:Interaction.Behaviors>
6879
<interactions:EventTriggerBehavior EventName="FormSubmissionFailed" SourceObject="{x:Bind ViewModel.Form}">

0 commit comments

Comments
 (0)