-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
270 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,35 +6,64 @@ | |
x:Class="FormViewSample.InputKit.MainPage" | ||
BackgroundColor="WhiteSmoke"> | ||
|
||
<ContentPage.BindingContext> | ||
<local:MainViewModel/> | ||
</ContentPage.BindingContext> | ||
<ContentPage.Content> | ||
<StackLayout Padding="30"> | ||
<Label Text="You can see FormView Below:"/> | ||
<input:FormView> | ||
<BoxView HeightRequest="1" Color="LightGray" /> | ||
<input:FormView IsValidated="{Binding IsValidated}"> | ||
|
||
<input:AdvancedEntry | ||
Text="{Binding Email}" | ||
IsRequired="True" | ||
Title="Place your email below:" | ||
Annotation="Email" | ||
Placeholder="[email protected]" | ||
AnnotationColor="Accent" | ||
ValidationMessage="Please type a valid email address" | ||
IsRequired="True" | ||
IconImage="ic_email_black_24dp.png" | ||
MinLength="10" | ||
MaxLength="50" | ||
/> | ||
|
||
<input:AdvancedEntry | ||
Text="{Binding NameSurname}" | ||
IsRequired="True" | ||
Title="Place your name below:" | ||
Annotation="NameSurname" | ||
Placeholder="John Doe" | ||
AnnotationColor="Accent" | ||
ValidationMessage="Please type your name correctly" | ||
IsRequired="True" | ||
IconImage="ic_account_circle_black_24dp.png" | ||
MinLength="5" | ||
MaxLength="30" | ||
/> | ||
|
||
<input:AdvancedEntry | ||
Text="{Binding Phone}" | ||
IsRequired="True" | ||
Title="Place your phone number below:" | ||
Annotation="Phone" | ||
Placeholder="5439998877" | ||
AnnotationColor="Accent" | ||
ValidationMessage="Please type your phone number correctly" | ||
IconImage="ic_account_circle_black_24dp.png" | ||
MaxLength="10" | ||
/> | ||
|
||
<input:CheckBox IsRequired="True" Type="Check" Text="I Accept User Agreement" /> | ||
|
||
<Label Text="Choose your subscription type:" /> | ||
<input:RadioButtonGroupView IsRequired="True" SelectedItemChanged="RadioButtonGroupView_SelectedItemChanged"> | ||
<input:RadioButton Text="Free" /> | ||
<input:RadioButton Text="Bronze" /> | ||
<input:RadioButton Text="Gold" /> | ||
<input:RadioButton Text="Platinium" /> | ||
</input:RadioButtonGroupView> | ||
|
||
<Button Command="{Binding SubmitCommand}" Margin="0,20" Text="Submit" BackgroundColor="Accent" CornerRadius="20" TextColor="White" /> | ||
</input:FormView> | ||
</StackLayout> | ||
</ContentPage.Content> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
FormViewSample.InputKit/FormViewSample.InputKit/MainViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using Xamarin.Forms; | ||
|
||
namespace FormViewSample.InputKit | ||
{ | ||
public class MainViewModel : INotifyPropertyChanged | ||
{ | ||
private string _nameSurname; | ||
private string _email; | ||
private string _phone; | ||
|
||
public MainViewModel() | ||
{ | ||
SubmitCommand = new Command(Submit); | ||
} | ||
public Command SubmitCommand { get; set; } | ||
public bool IsValidated { get; set; } | ||
public string NameSurname { get => _nameSurname; set { _nameSurname = value; OnPropertyChanged(); } } | ||
public string Email { get => _email; set { _email = value; OnPropertyChanged(); } } | ||
public string Phone { get => _phone; set { _phone = value; OnPropertyChanged(); } } | ||
|
||
async void Submit() | ||
{ | ||
if (!IsValidated) | ||
{ | ||
await Application.Current.MainPage.DisplayAlert("", "You must fill all areas correctly!", "OK"); | ||
} | ||
|
||
//DO SOME STUFFS HERE | ||
} | ||
|
||
|
||
#region INotifyPropertyChanged Implementation | ||
public event PropertyChangedEventHandler PropertyChanged; | ||
public void OnPropertyChanged([CallerMemberName]string propName = "") => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName)); | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.