summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs
blob: bf36afa47d49632c243090da35aff4dd7e455a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 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);
		}
	}
}