Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormView - Validation state sync fix #311

Merged
merged 2 commits into from
Sep 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions sandbox/SandboxMAUI/ViewModels/AdvancedEntryPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ async void Submit()
{
if (!IsValidated)
{
await Application.Current.MainPage.DisplayAlert("", "You must fill all areas correctly!", "OK");
await Application.Current.MainPage.DisplayAlert("", "You successfully submitted the form", "OK");
}

//DO SOME STUFFS HERE
}
}

}
2 changes: 1 addition & 1 deletion src/InputKit.Maui/InputKit.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<SingleProject>true</SingleProject>
<MauiVersion>6.0.486</MauiVersion>
<PackageId>InputKit.Maui</PackageId>
<Version>4.1.1</Version>
<Version>4.1.2</Version>
<DefineConstants Condition="$(TargetFramework.Contains('-windows'))">$(DefineConstants);UWP</DefineConstants>

<!-- NuGet Package Info -->
Expand Down
2 changes: 2 additions & 0 deletions src/InputKit.Maui/Shared/Controls/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ public void DisplayValidation()

this.Add(iconValidation.Value);
}

OnPropertyChanged(nameof(IsValid));
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/InputKit.Maui/Shared/Controls/FormView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void UnregisterEvent(BindableObject view)

private void SubmitButtonClicked(object sender, EventArgs e)
{
if (IsValidated)
if (CheckValidation(this))
{
SubmitCommand?.Execute(IsValidated);
}
Expand Down
1 change: 1 addition & 0 deletions src/InputKit.Maui/Shared/Controls/RadioButtonGroupView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ void UpdateSelected(object selected, EventArgs e)

SelectedItemChanged?.Invoke(this, new EventArgs());
SelectedItemChangedCommand?.Execute(CommandParameter);
OnPropertyChanged(nameof(IsValid));
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Xamarin.Forms.InputKit/Shared/Controls/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ public void DisplayValidation()

this.Children.Add(iconValidation.Value);
}

OnPropertyChanged(nameof(IsValid));
}

#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Forms.InputKit/Shared/Controls/FormView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void UnregisterEvent(BindableObject view)

private void SubmitButtonClicked(object sender, EventArgs e)
{
if (IsValidated)
if (CheckValidation(this))
{
SubmitCommand?.Execute(IsValidated);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ void UpdateSelected(object selected, EventArgs e)

SelectedItemChanged?.Invoke(this, new EventArgs());
SelectedItemChangedCommand?.Execute(CommandParameter);
OnPropertyChanged(nameof(IsValid));
}
}
private IEnumerable<RadioButton> GetChildRadioButtons(Layout<View> layout)
Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Forms.InputKit/Xamarin.Forms.InputKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>Plugin.InputKit</RootNamespace>
<PackageId>Xamarin.Forms.InputKit</PackageId>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<Version>4.1.1</Version>
<Version>4.1.2</Version>
<PackOnBuild>false</PackOnBuild>
<NeutralLanguage>en-US</NeutralLanguage>
<DefineConstants>$(DefineConstants);</DefineConstants>
Expand Down
5 changes: 0 additions & 5 deletions test/InputKit.Maui.Test/TestClasses/AnimationReadyHandler.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using Microsoft.Maui.Animations;
using Microsoft.Maui.Handlers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InputKit.Maui.Test.TestClasses;

Expand Down