summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs
blob: e571539adbef94dbb04713d37ad42f5349ec7bca (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
using System.Diagnostics;

namespace Xamarin.Forms.Controls
{
	public class NavigationBarGallery : ContentPage
	{
		public NavigationBarGallery (NavigationPage rootNavPage)
		{

			int toggleBarTextColor = 0;
			int toggleBarBackgroundColor = 0;

			Content = new StackLayout {
				Children = {
					new Button {
						Text = "Change BarTextColor", 
						Command = new Command (() => {
							if (toggleBarTextColor % 2 == 0) {
								rootNavPage.BarTextColor = Color.Teal;	
							} else {
								rootNavPage.BarTextColor = Color.Default;
							}
							toggleBarTextColor++;
						})
					},
					new Button {
						Text = "Change BarBackgroundColor", 
						Command = new Command (() => {
							if (toggleBarBackgroundColor % 2 == 0) {
								rootNavPage.BarBackgroundColor = Color.Navy;
							} else {
								rootNavPage.BarBackgroundColor = Color.Default;
							}
							toggleBarBackgroundColor++;

						})
					},
					new Button {
						Text = "Change Both to default", 
						Command = new Command (() => {
							rootNavPage.BarTextColor = Color.Default;
							rootNavPage.BarBackgroundColor = Color.Default;
						})
					},
					new Button {
						Text = "Make sure Tint still works", 
						Command = new Command (() => {
#pragma warning disable 618
							rootNavPage.Tint = Color.Red;
#pragma warning restore 618
						})
					},
					new Button {
						Text = "Black background, white text", 
						Command = new Command (() => {
							rootNavPage.BarTextColor = Color.White;
							rootNavPage.BarBackgroundColor = Color.Black;
						})
					}
				}
			};
		}
	}
}