summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
diff options
context:
space:
mode:
authorSeunghyun Choi <sh4682.choi@samsung.com>2017-01-12 20:12:18 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 11:11:16 +0900
commit671b4930f347fcc96f9e24d7c504aa72b7b971b9 (patch)
treea737b11ee409d8b4201696f81093b519fd934a7c /Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
parent28ad177fd48d37e4110b636cc17330d8dd08eb5f (diff)
downloadxamarin-forms-671b4930f347fcc96f9e24d7c504aa72b7b971b9.tar.gz
xamarin-forms-671b4930f347fcc96f9e24d7c504aa72b7b971b9.tar.bz2
xamarin-forms-671b4930f347fcc96f9e24d7c504aa72b7b971b9.zip
Add Switch Style
- Add Switch Style(CheckBox, Favorite) - Approval of the RFC is required. (http://suprem.sec.samsung.net/confluence/display/SPTDTLC/%5BFormsTizen%5D+RFC+5+-+Switch) Change-Id: If98be73fc84633b670328f723e0e4aa7ccebc82f Signed-off-by: Seunghyun Choi <sh4682.choi@samsung.com>
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs31
1 files changed, 29 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
index b3539e6c..c67a69a2 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs
@@ -1,5 +1,8 @@
using System;
+using System.ComponentModel;
using ElmSharp;
+using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
+using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Switch;
namespace Xamarin.Forms.Platform.Tizen
{
@@ -28,14 +31,22 @@ namespace Xamarin.Forms.Platform.Tizen
if (e.NewElement != null)
{
- Control.Style = "toggle";
-
+ UpdateStyle();
Control.StateChanged += CheckChangedHandler;
}
base.OnElementChanged(e);
}
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == Specific.SwitchStyleProperty.PropertyName)
+ {
+ UpdateStyle();
+ }
+ base.OnElementPropertyChanged(sender, e);
+ }
+
void CheckChangedHandler(object sender, EventArgs e)
{
Element.SetValue(Switch.IsToggledProperty, Control.IsChecked);
@@ -46,5 +57,21 @@ namespace Xamarin.Forms.Platform.Tizen
Control.IsChecked = Element.IsToggled;
}
+ void UpdateStyle()
+ {
+ switch (Specific.GetSwitchStyle(Element))
+ {
+ case SwitchStyle.CheckBox:
+ Control.Style = "default";
+ break;
+ case SwitchStyle.Favorite:
+ Control.Style = "favorite";
+ break;
+ default:
+ Control.Style = "toggle";
+ break;
+ }
+ ((IVisualElementController)Element).NativeSizeChanged();
+ }
}
}