public ExpandableCell(Layout header, Layout body, Layout footer)
        {
            this.Padding = 0;
            this.Spacing = 0;
            this.Children.Add (header);
            this.Children.Add (body);
            this.Children.Add (footer);
            this.body = body;
            this.IsClippedToBounds = true;

            var gestureRecognizer = new TapGestureRecognizer () { };

            gestureRecognizer.Tapped += (sender, e) => {
                double start = expanded ? bodyHeight : 0; // the starting height
                double offset = expanded ? -bodyHeight : bodyHeight; // the change over the animation
                expanded = !expanded;
                this.body.Animate (
                    name: "set height",
                    animation: new Xamarin.Forms.Animation((val) => {
                        this.body.HeightRequest = start + offset*val;
                    }),
                    length: 250,
                    easing: Easing.CubicInOut
                );
            };
            header.GestureRecognizers.Add (gestureRecognizer);
        }
		void FixChildLayouts (Layout<Xamarin.Forms.View> layout)
		{
			foreach (var child in layout.Children) {
				if (child is Layout<Xamarin.Forms.View>) {
					((Layout<Xamarin.Forms.View>)child).ForceLayout ();
					FixChildLayouts (child as Layout<Xamarin.Forms.View>);
				}
			}
		}
		void FixChildLayouts (Layout<Xamarin.Forms.View> layout)
		{
			foreach (var child in layout.Children) {
				if (child is StackLayout) {
					((StackLayout)child).ForceLayout ();
					FixChildLayouts (child as Layout<Xamarin.Forms.View>);
				}
				if (child is Xamarin.Forms.AbsoluteLayout) {
					((Xamarin.Forms.AbsoluteLayout)child).ForceLayout ();
					FixChildLayouts (child as Layout<Xamarin.Forms.View>);
				}
			}
		}
Beispiel #4
0
		private void SetupUserInterface ()
		{
			BackgroundColor = Colors.BackgroundColor;
			NavigationPage.SetHasNavigationBar (this, false);

			cancelButton = new Image {
				Source = Images.CancelButton,
				HorizontalOptions = LayoutOptions.Start,
				HeightRequest = 25,
				WidthRequest = 25
			};

			topLayout = new StackLayout {
				Children = { cancelButton },
				Padding = new Thickness (15, 15, 0, 0)
			};

			addFriendLabel = new Label {
				Style = Application.Current.Resources["MainLabelStyle"] as Style,
				Text = Strings.AddAFriend
			};

			usernameEntry = new MomentsEntry {
				Placeholder = Strings.Username,
				HeightRequest = 45
			};

			becomeFriendsButton = new Button {
				BackgroundColor = Colors.ButtonBackgroundColor,
				BorderRadius = 0,
				BorderWidth = 0,
				FontAttributes = FontAttributes.None,
				FontFamily = Fonts.HelveticaNeueThin,
				FontSize = 25,
				Text = Strings.BecomeFriends,
				TextColor = Colors.ButtonTextColor
			};

			mainLayout = new StackLayout {
				Children = { topLayout, addFriendLabel, usernameEntry, becomeFriendsButton },
				Spacing = 25
			};

			Content = mainLayout;
		}
 public LayoutHandler(NativeComponentRenderer renderer, XF.Layout layoutControl) : base(renderer, layoutControl)
 {
     LayoutControl = layoutControl ?? throw new System.ArgumentNullException(nameof(layoutControl));
 }
Beispiel #6
0
		/// <summary>
		/// Initializes a new instance of the <see cref="WF.Player.BottomBarPage"/> class.
		/// </summary>
		public BottomBarPage() : base()
		{
			BackgroundColor = App.Colors.Background;

			layout = new RelativeLayout() 
			{
				BackgroundColor = Color.Transparent,
				Padding = 0,
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
//				IsClippedToBounds = false,
			};

			contentLayout = new StackLayout() 
			{
				BackgroundColor = Color.Transparent,
				Padding = new Thickness(0),
			};

			bottomLayout = new StackLayout() 
			{
				BackgroundColor = App.Colors.Bar,
				HeightRequest = barHeight,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Orientation = StackOrientation.Horizontal,
				IsClippedToBounds = false,
			};

			layout.Children.Add(
				contentLayout,
				Constraint.Constant(0),
				Constraint.Constant(0),
				Constraint.RelativeToParent((parent) =>
					{
						return parent.Width;
					}),
				Constraint.RelativeToParent((parent) =>
					{
						return parent.Height - barHeight;
					}));

			#if __IOS__
			// Dark grey line on iOS
			var lineLayout = new BoxView() 
			{
				BackgroundColor = App.Colors.SeparatorLine,
				HeightRequest = 0.5f,
				HorizontalOptions = LayoutOptions.FillAndExpand,
			};

			layout.Children.Add(
				lineLayout,
				Constraint.Constant(0),
				Constraint.RelativeToParent((parent) => { return parent.Height - barHeight - 0.5f; }),
				Constraint.RelativeToParent((parent) => { return parent.Width; }),
				Constraint.Constant(0.5f));
			#endif

			layout.Children.Add(
				bottomLayout, 
				Constraint.Constant(0),
				Constraint.RelativeToParent((parent) =>
					{
						return parent.Height - barHeight;
					}),
				Constraint.RelativeToParent((parent) =>
					{
						return parent.Width;
					}),
				Constraint.Constant(barHeight));

			Content = layout;
		}
 void UpdatePicker(Layout<View> layout)
 {
     foreach (var child in layout.Children)
     {
         if (child is Layout<View>)
         {
             UpdatePicker(child as Layout<View>);
         }
         else if (child is Picker)
         {
             (child as Picker).VerticalOptions = LayoutOptions.FillAndExpand;
         }
     }
 }