Skip to content

Commit

Permalink
Merge pull request #311 from enisn/4.1-validation-state-fix
Browse files Browse the repository at this point in the history
FormView - Validation state sync fix
  • Loading branch information
enisn authored Sep 17, 2022
2 parents fd79c35 + 7a773ef commit 9d7bf76
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
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

0 comments on commit 9d7bf76

Please sign in to comment.