Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.
Merged
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
14 changes: 12 additions & 2 deletions XAML/ValidationCallback/ValidationCallback/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand All @@ -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);
}
}
Expand Down