summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Native/ContentPage.cs
blob: 32f24a0dad2e1963692e55e5f44f91f7d7cdaa0b (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
´╗┐using System;
using System.Collections.Generic;
using ElmSharp;

namespace Xamarin.Forms.Platform.Tizen.Native
{
	/// <summary>
	/// A basic page which can hold a single view.
	/// </summary>
	public class ContentPage : Background, IContainable<EvasObject>
	{
		/// <summary>
		/// The name of the part to be used when setting content.
		/// </summary>
		public const string ContentPartName = "overlay";

		/// <summary>
		/// Exposes the Children property, mapping it to the _canvas' Children property.
		/// </summary>
		public IList<EvasObject> Children => _canvas.Children;

		/// <summary>
		/// The canvas, used as a container for other objects.
		/// </summary>
		/// <remarks>
		/// The canvas holds all the Views that the ContentPage is composed of.
		/// </remarks>
		internal Canvas _canvas;

		/// <summary>
		/// Initializes a new instance of the ContentPage class.
		/// </summary>
		public ContentPage(EvasObject parent) : base(parent)
		{
			_canvas = new Canvas(this);
			SetPartContent(ContentPartName, _canvas);
		}

		/// <summary>
		/// Gets or sets the title.
		/// </summary>
		/// <value>The current title.p</value>
		public string Title
		{
			get;
			set;
		}

		/// <summary>
		/// Allows custom handling of events emitted when the layout has been updated.
		/// </summary>
		public event EventHandler<LayoutEventArgs> LayoutUpdated
		{
			add
			{
				_canvas.LayoutUpdated += value;
			}
			remove
			{
				_canvas.LayoutUpdated -= value;
			}
		}

		/// <summary>
		/// Handles the disposing of a ContentPage
		/// </summary>
		/// <remarks>
		/// Takes the proper care of discarding the canvas, then calls the base method.
		/// </remarks>
		protected override void OnUnrealize()
		{
			_canvas.Unrealize();
			base.OnUnrealize();
		}
	}
}