Update RadioButton 68/123868/3
authorsung-su.kim <sung-su.kim@samsung.com>
Fri, 7 Apr 2017 09:00:13 +0000 (18:00 +0900)
committersung-su.kim <sung-su.kim@samsung.com>
Mon, 17 Apr 2017 05:18:22 +0000 (14:18 +0900)
- Overriding Measure

Change-Id: Id27860edf946c10e3f9bbd94514feaa039973f9b

Tizen.Xamarin.Forms.Extension.Renderer/RadioButtonRenderer.cs [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 27cf855..283a220
@@ -7,9 +7,12 @@ using Xamarin.Forms.Platform.Tizen;
 using Xamarin.Forms.Platform.Tizen.Native;
 using Tizen.Xamarin.Forms.Extension;
 using Tizen.Xamarin.Forms.Extension.Renderer;
+using ESize = ElmSharp.Size;
+using Size = Xamarin.Forms.Size;
 using TForms = Xamarin.Forms.Platform.Tizen.Forms;
 
 [assembly: ExportRenderer(typeof(RadioButton), typeof(RadioButtonRenderer))]
+
 namespace Tizen.Xamarin.Forms.Extension.Renderer
 {
     public class RadioButtonRenderer : ViewRenderer<RadioButton, Radio>
@@ -173,8 +176,31 @@ namespace Tizen.Xamarin.Forms.Extension.Renderer
             {
                 textblock.TextStyle = textStyle;
             }
+
             Control.EdjeObject.EmitSignal(emission, "elm");
         }
+
+        protected override Size MinimumSize()
+        {
+            return Measure(Control.MinimumWidth, Control.MinimumHeight).ToDP();
+        }
+
+        protected override ESize Measure(int availableWidth, int availableHeight)
+        {
+            var size = Control.Geometry;
+
+            Control.Resize(availableWidth, size.Height);
+
+            var formattedSize = Control.EdjeObject["elm.text"].TextBlockFormattedSize;
+
+            Control.Resize(size.Width, size.Height);
+
+            return new ESize()
+            {
+                Width = Control.MinimumWidth + formattedSize.Width,
+                Height = Math.Max(Control.MinimumHeight, formattedSize.Height),
+            };
+        }
     }
 
     internal class RadioGroupManager
@@ -238,4 +264,4 @@ namespace Tizen.Xamarin.Forms.Extension.Renderer
             }
         }
     }
-}
+}
\ No newline at end of file