Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 73f50b7

Browse files
authored
fix err (#627)
when you entered the value 999 (i.e. more than 360), the application collapsed. VS 2019+Samsung SM-L120F (Android 5.1-API 22)
1 parent 70ad629 commit 73f50b7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

XAML/ValidationCallback/ValidationCallback/HomePage.xaml.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ public partial class HomePage : ContentPage
88

99
public double Angle {
1010
get { return (double)GetValue (AngleProperty); }
11-
set { SetValue (AngleProperty, value); }
11+
set
12+
{
13+
if (IsValidValue(null, value))
14+
{
15+
SetValue (AngleProperty, value);
16+
}
17+
else
18+
{
19+
DisplayAlert("Alert", "Angle must be between 0-360", "OK");
20+
}
21+
}
1222
}
1323

1424
public HomePage ()
@@ -19,7 +29,7 @@ public HomePage ()
1929
static bool IsValidValue (BindableObject view, object value)
2030
{
2131
double result;
22-
bool isDouble = double.TryParse (value.ToString (), out result);
32+
double.TryParse (value.ToString (), out result);
2333
return (result >= 0 && result <= 360);
2434
}
2535
}

0 commit comments

Comments
 (0)