summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs27
1 files changed, 18 insertions, 9 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
index 68e697ed..547f9312 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
@@ -1,10 +1,10 @@
using System;
using System.Globalization;
-using EColor = ElmSharp.Color;
+using ELayout = ElmSharp.Layout;
namespace Xamarin.Forms.Platform.Tizen
{
- public class TimePickerRenderer : ViewRenderer<TimePicker, Native.Button>
+ public class TimePickerRenderer : ViewRenderer<TimePicker, ELayout>
{
//TODO need to add internationalization support
const string DialogTitle = "Choose Time";
@@ -14,6 +14,7 @@ namespace Xamarin.Forms.Platform.Tizen
string _format;
TimeSpan _time;
+ Native.Entry _realControl;
public TimePickerRenderer()
{
@@ -26,13 +27,21 @@ namespace Xamarin.Forms.Platform.Tizen
{
if (Control == null)
{
- var button = new Native.Button(Forms.Context.MainWindow);
- SetNativeControl(button);
+ var layout = new ELayout(Forms.Context.MainWindow);
+ layout.SetTheme("layout", "editfield", "singleline");
+ _realControl = new Native.Entry(layout)
+ {
+ IsSingleLine = true,
+ HorizontalTextAlignment = Native.TextAlignment.Center,
+ };
+ _realControl.AllowFocus(false);
+ layout.SetPartContent("elm.swallow.content", _realControl);
+ SetNativeControl(layout);
}
if (e.OldElement != null)
{
- Control.Clicked -= ButtonClickedHandler;
+ _realControl.Clicked -= ClickedHandler;
}
if (e.NewElement != null)
@@ -41,13 +50,13 @@ namespace Xamarin.Forms.Platform.Tizen
_format = s_defaultFormat;
UpdateTimeAndFormat();
- Control.Clicked += ButtonClickedHandler;
+ _realControl.Clicked += ClickedHandler;
}
base.OnElementChanged(e);
}
- void ButtonClickedHandler(object o, EventArgs e)
+ void ClickedHandler(object o, EventArgs e)
{
Native.DateTimePickerDialog dialog = new Native.DateTimePickerDialog(Forms.Context.MainWindow)
{
@@ -81,7 +90,7 @@ namespace Xamarin.Forms.Platform.Tizen
void UpdateTextColor()
{
- Control.TextColor = Element.TextColor.ToNative();
+ _realControl.TextColor = Element.TextColor.ToNative();
}
void UpdateTime()
@@ -93,7 +102,7 @@ namespace Xamarin.Forms.Platform.Tizen
void UpdateTimeAndFormat()
{
// Xamarin using DateTime formatting (https://developer.xamarin.com/api/property/Xamarin.Forms.TimePicker.Format/)
- Control.Text = new DateTime(_time.Ticks).ToString(_format);
+ _realControl.Text = new DateTime(_time.Ticks).ToString(_format);
}
}
}