From 16e29f36c3e9071386479d7aebc04e75dd420896 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Sat, 17 Sep 2022 20:59:13 +0300 Subject: [PATCH 1/2] Validation state sync fix --- sandbox/SandboxMAUI/ViewModels/AdvancedEntryPageViewModel.cs | 5 ++--- src/InputKit.Maui/Shared/Controls/CheckBox.cs | 2 ++ src/InputKit.Maui/Shared/Controls/FormView.cs | 2 +- src/InputKit.Maui/Shared/Controls/RadioButtonGroupView.cs | 1 + src/Xamarin.Forms.InputKit/Shared/Controls/CheckBox.cs | 2 ++ src/Xamarin.Forms.InputKit/Shared/Controls/FormView.cs | 2 +- .../Shared/Controls/RadioButtonGroupView.cs | 1 + test/InputKit.Maui.Test/TestClasses/AnimationReadyHandler.cs | 5 ----- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sandbox/SandboxMAUI/ViewModels/AdvancedEntryPageViewModel.cs b/sandbox/SandboxMAUI/ViewModels/AdvancedEntryPageViewModel.cs index da65602..af22a52 100644 --- a/sandbox/SandboxMAUI/ViewModels/AdvancedEntryPageViewModel.cs +++ b/sandbox/SandboxMAUI/ViewModels/AdvancedEntryPageViewModel.cs @@ -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 } -} - +} \ No newline at end of file diff --git a/src/InputKit.Maui/Shared/Controls/CheckBox.cs b/src/InputKit.Maui/Shared/Controls/CheckBox.cs index 0edad61..619c83a 100644 --- a/src/InputKit.Maui/Shared/Controls/CheckBox.cs +++ b/src/InputKit.Maui/Shared/Controls/CheckBox.cs @@ -286,6 +286,8 @@ public void DisplayValidation() this.Add(iconValidation.Value); } + + OnPropertyChanged(nameof(IsValid)); } #endregion diff --git a/src/InputKit.Maui/Shared/Controls/FormView.cs b/src/InputKit.Maui/Shared/Controls/FormView.cs index 901b3e8..d6d2f6e 100644 --- a/src/InputKit.Maui/Shared/Controls/FormView.cs +++ b/src/InputKit.Maui/Shared/Controls/FormView.cs @@ -88,7 +88,7 @@ void UnregisterEvent(BindableObject view) private void SubmitButtonClicked(object sender, EventArgs e) { - if (IsValidated) + if (CheckValidation(this)) { SubmitCommand?.Execute(IsValidated); } diff --git a/src/InputKit.Maui/Shared/Controls/RadioButtonGroupView.cs b/src/InputKit.Maui/Shared/Controls/RadioButtonGroupView.cs index 989e760..84e8761 100644 --- a/src/InputKit.Maui/Shared/Controls/RadioButtonGroupView.cs +++ b/src/InputKit.Maui/Shared/Controls/RadioButtonGroupView.cs @@ -195,6 +195,7 @@ void UpdateSelected(object selected, EventArgs e) SelectedItemChanged?.Invoke(this, new EventArgs()); SelectedItemChangedCommand?.Execute(CommandParameter); + OnPropertyChanged(nameof(IsValid)); } } diff --git a/src/Xamarin.Forms.InputKit/Shared/Controls/CheckBox.cs b/src/Xamarin.Forms.InputKit/Shared/Controls/CheckBox.cs index 16316fe..1b9f0d9 100644 --- a/src/Xamarin.Forms.InputKit/Shared/Controls/CheckBox.cs +++ b/src/Xamarin.Forms.InputKit/Shared/Controls/CheckBox.cs @@ -283,6 +283,8 @@ public void DisplayValidation() this.Children.Add(iconValidation.Value); } + + OnPropertyChanged(nameof(IsValid)); } #endregion diff --git a/src/Xamarin.Forms.InputKit/Shared/Controls/FormView.cs b/src/Xamarin.Forms.InputKit/Shared/Controls/FormView.cs index d5212dd..1cb6c1d 100644 --- a/src/Xamarin.Forms.InputKit/Shared/Controls/FormView.cs +++ b/src/Xamarin.Forms.InputKit/Shared/Controls/FormView.cs @@ -92,7 +92,7 @@ void UnregisterEvent(BindableObject view) private void SubmitButtonClicked(object sender, EventArgs e) { - if (IsValidated) + if (CheckValidation(this)) { SubmitCommand?.Execute(IsValidated); } diff --git a/src/Xamarin.Forms.InputKit/Shared/Controls/RadioButtonGroupView.cs b/src/Xamarin.Forms.InputKit/Shared/Controls/RadioButtonGroupView.cs index 758edd8..5caa4f8 100644 --- a/src/Xamarin.Forms.InputKit/Shared/Controls/RadioButtonGroupView.cs +++ b/src/Xamarin.Forms.InputKit/Shared/Controls/RadioButtonGroupView.cs @@ -194,6 +194,7 @@ void UpdateSelected(object selected, EventArgs e) SelectedItemChanged?.Invoke(this, new EventArgs()); SelectedItemChangedCommand?.Execute(CommandParameter); + OnPropertyChanged(nameof(IsValid)); } } private IEnumerable GetChildRadioButtons(Layout layout) diff --git a/test/InputKit.Maui.Test/TestClasses/AnimationReadyHandler.cs b/test/InputKit.Maui.Test/TestClasses/AnimationReadyHandler.cs index 8e46abc..22edcf4 100644 --- a/test/InputKit.Maui.Test/TestClasses/AnimationReadyHandler.cs +++ b/test/InputKit.Maui.Test/TestClasses/AnimationReadyHandler.cs @@ -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; From 7a773ef205724c1d4b2d0ee4e2850b4dfb354b5e Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Sat, 17 Sep 2022 20:59:40 +0300 Subject: [PATCH 2/2] Update version to `4.1.2` --- src/InputKit.Maui/InputKit.Maui.csproj | 2 +- src/Xamarin.Forms.InputKit/Xamarin.Forms.InputKit.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/InputKit.Maui/InputKit.Maui.csproj b/src/InputKit.Maui/InputKit.Maui.csproj index e761a16..4c103e9 100644 --- a/src/InputKit.Maui/InputKit.Maui.csproj +++ b/src/InputKit.Maui/InputKit.Maui.csproj @@ -8,7 +8,7 @@ true 6.0.486 InputKit.Maui - 4.1.1 + 4.1.2 $(DefineConstants);UWP diff --git a/src/Xamarin.Forms.InputKit/Xamarin.Forms.InputKit.csproj b/src/Xamarin.Forms.InputKit/Xamarin.Forms.InputKit.csproj index 6e14260..1965566 100644 --- a/src/Xamarin.Forms.InputKit/Xamarin.Forms.InputKit.csproj +++ b/src/Xamarin.Forms.InputKit/Xamarin.Forms.InputKit.csproj @@ -8,7 +8,7 @@ Plugin.InputKit Xamarin.Forms.InputKit $(AssemblyName) ($(TargetFramework)) - 4.1.1 + 4.1.2 false en-US $(DefineConstants);