summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs
blob: d93d2d662250410d30adb36209f034ea423d1199 (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
namespace Xamarin.Forms.Controls
{
	public partial class NestedNativeControlGalleryPage : ContentPage
	{
		public StackLayout Layout { get; set; }

		public bool NativeControlsAdded { get; set; }

		public const string ReadyForNativeControlsMessage = "ReadyForNativeControls";

		protected override void OnAppearing()
		{
			base.OnAppearing();
			MessagingCenter.Send(this, ReadyForNativeControlsMessage);
		}

		public NestedNativeControlGalleryPage ()
		{
			Layout = new StackLayout { Padding = 20, VerticalOptions = LayoutOptions.FillAndExpand };

			Content = new ScrollView { Content = Layout };

			var label = new Label { Text = "There should be some native controls right below this", FontSize = 12 };

			var testLabel = new Label { Text = "Forms Label", FontSize = 14 };
			var button = new Button { Text = "Resize Forms Label", HeightRequest = 80	};
			double originalSize = testLabel.FontSize;
			button.Clicked += (sender, args) => { testLabel.FontSize = testLabel.FontSize == originalSize ? 24 : 14; };

			Layout.Children.Add(testLabel); 
			Layout.Children.Add(button); 
			Layout.Children.Add(label); 
		}
	}
}