summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/TimePicker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core/TimePicker.cs')
-rw-r--r--Xamarin.Forms.Core/TimePicker.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/TimePicker.cs b/Xamarin.Forms.Core/TimePicker.cs
new file mode 100644
index 00000000..a9cf2e19
--- /dev/null
+++ b/Xamarin.Forms.Core/TimePicker.cs
@@ -0,0 +1,29 @@
+using System;
+using Xamarin.Forms.Platform;
+
+namespace Xamarin.Forms
+{
+ [RenderWith(typeof(_TimePickerRenderer))]
+ public class TimePicker : View
+ {
+ public static readonly BindableProperty FormatProperty = BindableProperty.Create("Format", typeof(string), typeof(TimePicker), "t");
+
+ public static readonly BindableProperty TimeProperty = BindableProperty.Create("Time", typeof(TimeSpan), typeof(TimePicker), new TimeSpan(0), BindingMode.TwoWay, (bindable, value) =>
+ {
+ var time = (TimeSpan)value;
+ return time.TotalHours < 24 && time.TotalMilliseconds >= 0;
+ });
+
+ public string Format
+ {
+ get { return (string)GetValue(FormatProperty); }
+ set { SetValue(FormatProperty, value); }
+ }
+
+ public TimeSpan Time
+ {
+ get { return (TimeSpan)GetValue(TimeProperty); }
+ set { SetValue(TimeProperty, value); }
+ }
+ }
+} \ No newline at end of file