示例#1
0
		public void MarginsAffectPositionInContentView ()
		{
			var platform = new UnitPlatform ((b, d, e) => new SizeRequest(new Size(100,50)));

			var parent = new ContentView {
				Platform = platform,
				IsPlatformEnabled = true,
			};
			var child = new Button {
				Text = "Test",
				Platform = platform,
				IsPlatformEnabled = true,
			};
			

			child.Margin = new Thickness (10, 20, 30, 40);
			parent.Content = child;

			parent.Layout (new Rectangle (0, 0, 140, 110));
			Assert.AreEqual (new Rectangle (10, 20, 100, 50), child.Bounds);
		}
示例#2
0
		public void ChangingMarginCausesRelayout ()
		{
			var platform = new UnitPlatform ((b, d, e) => new SizeRequest(new Size(100,50)));

			var parent = new ContentView {
				Platform = platform,
				IsPlatformEnabled = true,
			};
			var child = new Button {
				Text = "Test",
				VerticalOptions = LayoutOptions.Start,
				HorizontalOptions = LayoutOptions.Start,
				Platform = platform,
				IsPlatformEnabled = true,
			};
			

			child.Margin = new Thickness (10, 20, 30, 40);
			parent.Content = child;

			parent.Layout (new Rectangle (0, 0, 1000, 1000));
			Assert.AreEqual (new Rectangle (10, 20, 100, 50), child.Bounds);
		}