summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs
blob: 69065c8afbe2c6f2d222b06444eed771a757840d (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
42
43
using System.Collections.Generic;
using ElmSharp;

namespace Xamarin.Forms.Platform.Tizen
{
	public class ViewCellRenderer : CellRenderer
	{
		public ViewCellRenderer() : base("full")
		{
			MainContentPart = "elm.swallow.content";
		}

		protected string MainContentPart { get; set; }

		protected override EvasObject OnGetContent(Cell cell, string part)
		{
			if (part == MainContentPart)
			{
				var viewCell = cell as ViewCell;
				if (viewCell != null)
				{
					var renderer = Platform.GetOrCreateRenderer(viewCell.View);
					int height = (int)viewCell.RenderHeight;
					height = height <= 0 ? FindCellContentHeight(viewCell) : height;

					renderer.NativeView.MinimumHeight = height;
					return renderer.NativeView;
				}
				return null;
			}
			return null;
		}

		protected override bool OnCellPropertyChanged(Cell cell, string property, Dictionary<string, EvasObject> realizedView)
		{
			if (property == "View")
			{
				return true;
			}
			return base.OnCellPropertyChanged(cell, property, realizedView);
		}
	}
}