diff --git a/XAML/ValidationCallback/ValidationCallback/HomePage.xaml.cs b/XAML/ValidationCallback/ValidationCallback/HomePage.xaml.cs index 01d30d649c..de881efa9a 100755 --- a/XAML/ValidationCallback/ValidationCallback/HomePage.xaml.cs +++ b/XAML/ValidationCallback/ValidationCallback/HomePage.xaml.cs @@ -8,7 +8,17 @@ public partial class HomePage : ContentPage public double Angle { get { return (double)GetValue (AngleProperty); } - set { SetValue (AngleProperty, value); } + set + { + if (IsValidValue(null, value)) + { + SetValue (AngleProperty, value); + } + else + { + DisplayAlert("Alert", "Angle must be between 0-360", "OK"); + } + } } public HomePage () @@ -19,7 +29,7 @@ public HomePage () static bool IsValidValue (BindableObject view, object value) { double result; - bool isDouble = double.TryParse (value.ToString (), out result); + double.TryParse (value.ToString (), out result); return (result >= 0 && result <= 360); } }