From 79bf87f2bc00d823cf8b25ed7d0d3650cf819b4c Mon Sep 17 00:00:00 2001 From: Kangho Hur Date: Fri, 16 Dec 2016 11:00:07 +0900 Subject: Add Tizen backend renderer - Xamarin.Forms.Platform.Tizen has been added - Xamarin.Forms.Maps.Tizen has been added - RPM build spec has been added Change-Id: I0021e0f040d97345affc87512ee0f6ce437f4e6d --- .../Renderers/LayoutRenderer.cs | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs') diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs new file mode 100644 index 00000000..61421c79 --- /dev/null +++ b/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs @@ -0,0 +1,57 @@ +using System; + +namespace Xamarin.Forms.Platform.Tizen +{ + /// + /// Renderer of a Layout. + /// + public class LayoutRenderer : ViewRenderer + { + /// + /// Default constructor. + /// + public LayoutRenderer() + { + } + + protected override void UpdateLayout() + { + // in case of layouts we need to make sure that the minimum size of the native control is updated + // this is important in case of ScrollView, when it's content is likely to be wider/higher than the window + // EFL does not allow control to be larger than the window if it's minimum size is smaller than window dimensions + ScrollView scrollView = Element.Parent as ScrollView; + if (scrollView != null) + { + Size size = scrollView.ContentSize; + Control.MinimumWidth = ToNativeDimension(Math.Max(size.Width, scrollView.Content.Width)); + Control.MinimumHeight = ToNativeDimension(Math.Max(size.Height, scrollView.Content.Height)); + } + + base.UpdateLayout(); + } + + protected override void OnElementChanged(ElementChangedEventArgs e) + { + if (null == Control) + { + var canvas = new Native.Canvas(Forms.Context.MainWindow); + canvas.LayoutUpdated += OnLayoutUpdated; + SetNativeControl(canvas); + } + + base.OnElementChanged(e); + } + + protected override void Dispose(bool disposing) + { + Control.LayoutUpdated -= OnLayoutUpdated; + + base.Dispose(disposing); + } + + void OnLayoutUpdated(object sender, Native.LayoutEventArgs e) + { + DoLayout(e); + } + } +} -- cgit v1.2.3