summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla22229.xaml.cs
blob: 12e7143fea1f150526b91e31e1871aa61e6af9d7 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls
{
#if APP
	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Bugzilla, 22229, "ToolbarItems not clearing", PlatformAffected.iOS | PlatformAffected.WinPhone, NavigationBehavior.PushAsync)]
	public partial class Bugzilla22229 : TabbedPage
	{
		string _prefix;

		public Bugzilla22229()
		{
			InitializeComponent();
			switch (Device.RuntimePlatform) {
			case Device.iOS:
				_prefix = "Images/";
				break;
			case Device.Android:
				_prefix = "";
				break;
			case Device.WinRT:
			case Device.UWP:
			case Device.WinPhone:
				_prefix = "Assets/";
				break;
			}
			InitializeActionBar();
		}


		public void OnCurrentPageChanged(object sender, EventArgs e)
		{
			InitializeActionBar();
		}

		void InitializeActionBar()
		{
			ToolbarItems.Clear();
			if (CurrentPage == Children[0])
			{
				ToolbarItems.Add(new ToolbarItem("Action 1", null, () => { }, ToolbarItemOrder.Primary, 1));
				ToolbarItems.Add(new ToolbarItem("Action 2", null, () => { }, ToolbarItemOrder.Primary, 2));

				ToolbarItems.Add(new ToolbarItem("Action 3", null, () => { }, ToolbarItemOrder.Secondary, 3));
				ToolbarItems.Add(new ToolbarItem("Action 4", null, () => { }, ToolbarItemOrder.Secondary, 4));
				ToolbarItems.Add(new ToolbarItem("Action 5", null, () => { }, ToolbarItemOrder.Secondary, 5));
			}

		}
	}
#endif
}