diff options
author | Kangho Hur <kangho.hur@samsung.com> | 2016-12-16 11:00:07 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-07-10 11:11:14 +0900 |
commit | 79bf87f2bc00d823cf8b25ed7d0d3650cf819b4c (patch) | |
tree | 99d3412413a92c057cb8ad8429ddb0c7d4cb8c14 /Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs | |
parent | b7297c8ac01d6ce2d5f038d3df8f4bc9e74a8162 (diff) | |
download | xamarin-forms-79bf87f2bc00d823cf8b25ed7d0d3650cf819b4c.tar.gz xamarin-forms-79bf87f2bc00d823cf8b25ed7d0d3650cf819b4c.tar.bz2 xamarin-forms-79bf87f2bc00d823cf8b25ed7d0d3650cf819b4c.zip |
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
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs | 57 |
1 files changed, 57 insertions, 0 deletions
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 +{ + /// <summary> + /// Renderer of a Layout. + /// </summary> + public class LayoutRenderer : ViewRenderer<Layout, Native.Canvas> + { + /// <summary> + /// Default constructor. + /// </summary> + 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<Layout> 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); + } + } +} |