예제 #1
0
		public App()
		{
			usernameentry = new MyEntry ();
			usernameentry.WidthRequest = 100;
			usernameentry.HeightRequest = 40;
			usernameentry.Placeholder="username";
			usernameentry.Top = 10;
			usernameentry.BackgroundColor = Color.Yellow;

			passentry = new MyEntry ();
			passentry.WidthRequest = 100;
			passentry.HeightRequest = 40;
			passentry.Placeholder = "Password";
			passentry.MarginTop = 20; 

			passentry.BackgroundColor = Color.FromRgb (102, 204, 255);


			myStacklayout stacklayout = new myStacklayout ();  
			stacklayout.BackgroundColor=Color.FromRgb (170, 221, 255);
			stacklayout.WidthRequest = 200;
			stacklayout.HeightRequest = 100;
			stacklayout.Top = 200;

			stacklayout.addview (usernameentry);
			stacklayout.addview (passentry);

			relativelayout.addview (stacklayout);  


			okbut = new MyButton ();
			okbut.HeightRequest = 40;
			okbut.WidthRequest = 100;
			okbut.Top = 400;
			okbut.Text="Ok";
			okbut.TextColor=Color.FromRgb (102, 204, 255);
			okbut.BorderColor= Color.FromRgb (102, 204, 255);
			okbut.BorderRadius = 2;
			okbut.BackgroundColor= Color.White;
			okbut.BorderWidth = 1;
			relativelayout.addview (okbut);  
		} 
예제 #2
0
		public void addview(myStacklayout stacklayout,View view)
		{ 

			if (stacklayout.hasrelativelayout ()) { 

				Constraint x = Constraint.RelativeToView (view,
					(parent, sibling) => {
						return sibling.X + sibling.Width + (stacklayout.MarginLeft.HasValue ? stacklayout.MarginLeft.Value : 0);
					});
				Constraint y = Constraint.RelativeToView (view,
					(parent, sibling) => {
						return sibling.X + sibling.Width + (stacklayout.MarginTop.HasValue ? stacklayout.MarginTop.Value : 0);
					});  
				this.Children.Add (stacklayout, x, y);
			}
		}
예제 #3
0
		public void addview(myStacklayout stacklayout)
		{ 
			Constraint y=Constraint.RelativeToParent (
				(parent) => { return parent.Height / 2 - stacklayout.HeightRequest/2; } );  

			Constraint x=Constraint.RelativeToParent (
				(parent) => { return parent.Width / 2 - stacklayout.WidthRequest/2; } ); 

			if (stacklayout.Top.HasValue) { 
				y = Constraint.RelativeToParent (
					(parent) => { return stacklayout.Top.HasValue?stacklayout.Top.Value:0; } );

			} 
			this.Children.Add (stacklayout, x, y);
		}