summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/CoreGalleryPages/CoreBoxViewGalleryPage.cs
blob: 57ceaf44cb3b6b7e8460abdd6bda320754a3e696 (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
using System;
using System.Threading;

using Xamarin.Forms.CustomAttributes;

namespace Xamarin.Forms.Controls
{
	internal class CoreBoxViewGalleryPage : CoreGalleryPage<BoxView>
	{
		static readonly object SyncLock = new object ();
		static readonly Random Rand = new Random ();
		
		protected override bool SupportsFocus
		{
			get { return false; }
		}

		protected override void InitializeElement (BoxView element)
		{
			lock (SyncLock) {
				var red = Rand.NextDouble ();
				var green = Rand.NextDouble ();
				var blue = Rand.NextDouble ();
				element.Color = new Color (red, green, blue);
			}
		}

		protected override void Build (StackLayout stackLayout)
		{
			base.Build (stackLayout);

			var colorContainer = new ViewContainer<BoxView> (Test.BoxView.Color, new BoxView { Color = Color.Pink });

			Add (colorContainer);
		}
	}
}