diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Native')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Native/Button.cs | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Button.cs b/Xamarin.Forms.Platform.Tizen/Native/Button.cs index 8f85da63..71ec0c10 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/Button.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/Button.cs @@ -20,7 +20,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native /// <summary> /// The internal padding of the button, helps to determine the size. /// </summary> - readonly ESize _internalPadding; + ESize _internalPadding; /// <summary> /// Optional image, if set will be drawn on the button. @@ -201,6 +201,18 @@ namespace Xamarin.Forms.Platform.Tizen.Native var padding = _internalPadding; + if (Style == "circle") + { + var circleTextPadding = (EdjeObject["icon_text_padding"]?.Geometry.Height).GetValueOrDefault(0); + var circleHeight = padding.Height + ((rawSize.Width == 0) ? 0 : circleTextPadding + formattedSize.Height); + + return new ESize + { + Width = padding.Width, + Height = circleHeight + }; + } + if (rawSize.Width > availableWidth) { // if the raw text width is larger than the available width, use @@ -299,5 +311,30 @@ namespace Xamarin.Forms.Platform.Tizen.Native SetPartContent("icon", _image); } } + + public void UpdateStyle(string style) + { + if (Style != style) + { + Style = style; + + if (Style == "circle") + { + var circleSize = (EdjeObject["bg"]?.Geometry.Width).GetValueOrDefault(0); + _internalPadding = new ESize(circleSize, circleSize); + _span.HorizontalTextAlignment = TextAlignment.Center; + } + else if (Style == "bottom") + { + _internalPadding = GetInternalPadding(); + _span.HorizontalTextAlignment = TextAlignment.Auto; + } + else + { + _span.HorizontalTextAlignment = TextAlignment.Auto; + } + ApplyTextAndStyle(); + } + } } } |