diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs index 95828c04..46af3520 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs @@ -1,5 +1,8 @@ -using System; +using System; +using Xamarin.Forms.PlatformConfiguration.TizenSpecific; + using EColor = ElmSharp.Color; +using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Entry; namespace Xamarin.Forms.Platform.Tizen { @@ -21,6 +24,7 @@ namespace Xamarin.Forms.Platform.Tizen RegisterPropertyHandler(Entry.KeyboardProperty, UpdateKeyboard); RegisterPropertyHandler(Entry.PlaceholderProperty, UpdatePlaceholder); RegisterPropertyHandler(Entry.PlaceholderColorProperty, UpdatePlaceholderColor); + RegisterPropertyHandler(Specific.FontWeightProperty, UpdateFontWeight); } protected override void OnElementChanged(ElementChangedEventArgs<Entry> e) @@ -123,5 +127,42 @@ namespace Xamarin.Forms.Platform.Tizen { Control.PlaceholderColor = Element.PlaceholderColor.IsDefault ? s_defaultPlaceholderColor : Element.PlaceholderColor.ToNative(); } + + void UpdateFontWeight() + { + var weight = Specific.GetFontWeight(Element); + Control.FontWeight = ConvertToNativeFontWeight(weight); + } + + Native.FontWeight ConvertToNativeFontWeight(FontWeight weight) + { + switch (weight) + { + case FontWeight.Bold: + return Native.FontWeight.Bold; + case FontWeight.SemiBold: + return Native.FontWeight.SemiBold; + case FontWeight.UltraBold: + return Native.FontWeight.UltraBold; + case FontWeight.Black: + return Native.FontWeight.Black; + case FontWeight.ExtraBlack: + return Native.FontWeight.ExtraBlack; + case FontWeight.Book: + return Native.FontWeight.Book; + case FontWeight.Light: + return Native.FontWeight.Light; + case FontWeight.Medium: + return Native.FontWeight.Medium; + case FontWeight.Normal: + return Native.FontWeight.Normal; + case FontWeight.Thin: + return Native.FontWeight.Thin; + case FontWeight.UltraLight: + return Native.FontWeight.UltraLight; + default: + return Native.FontWeight.None; + } + } } } |