Exemple #1
0
        public ScavengerHuntCaptureView(Models.ScavengerHuntView item)
        {
            BaseViewModel.CreateAndBind <ScavengerHuntCaptureViewModel> (this, item);
            SetBinding(ScavengerHuntCaptureView.NavigationProperty, new Binding("Navigation"));

            Title = "Found Something?";
            NavigationPage.SetBackButtonTitle(this, "");

            HuntItem = item;

            SetBinding(CameraContentPage.IsPresentedProperty, new Binding("CameraIsPresented", BindingMode.TwoWay));
            SetBinding(CameraContentPage.CapturedImageProperty, new Binding("CameraImage", BindingMode.TwoWay));

            var relativeLayout = new RelativeLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            var needStack = CreateNeedStack();

            relativeLayout.Children.Add(needStack,
                                        Constraint.RelativeToParent(parent => { return(parent.X); }),
                                        Constraint.RelativeToParent(parent => { return(parent.Y); }),
                                        Constraint.RelativeToParent(parent => { return(parent.Width); }),
                                        Constraint.RelativeToParent(parent => { return((parent.Height / 2) - 0.25); })
                                        );

            var separator = CreateSeparator();

            relativeLayout.Children.Add(separator,
                                        Constraint.RelativeToParent(parent => { return(parent.X); }),
                                        Constraint.RelativeToView(needStack, (parent, sibling) => { return(sibling.Height); }),
                                        Constraint.RelativeToParent(parent => { return(parent.Width); }),
                                        Constraint.Constant(0.5)
                                        );

            var haveStack = CreateHaveStack();

            relativeLayout.Children.Add(haveStack,
                                        Constraint.RelativeToParent(parent => { return(parent.X); }),
                                        Constraint.RelativeToView(separator, (parent, sibling) => { return(sibling.Y + sibling.Height); }),
                                        Constraint.RelativeToParent(parent => { return(parent.Width); }),
                                        Constraint.RelativeToParent(parent => { return((parent.Height / 2) - 0.25); })
                                        );

            Content = relativeLayout;
        }
		public ScavengerHuntCaptureView (Models.ScavengerHuntView item)
		{
			BaseViewModel.CreateAndBind<ScavengerHuntCaptureViewModel> (this, item);
			SetBinding (ScavengerHuntCaptureView.NavigationProperty, new Binding ("Navigation"));

			Title = "Found Something?";
			NavigationPage.SetBackButtonTitle (this, "");

			HuntItem = item;

			SetBinding (CameraContentPage.IsPresentedProperty, new Binding("CameraIsPresented", BindingMode.TwoWay));
			SetBinding (CameraContentPage.CapturedImageProperty, new Binding("CameraImage", BindingMode.TwoWay));

			var relativeLayout = new RelativeLayout 
			{
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand
			};

			var needStack = CreateNeedStack ();
			relativeLayout.Children.Add (needStack,
				Constraint.RelativeToParent (parent => { return parent.X; }),
				Constraint.RelativeToParent (parent => { return parent.Y; }),
				Constraint.RelativeToParent (parent => { return parent.Width; }),
				Constraint.RelativeToParent (parent => { return (parent.Height / 2) - 0.25; })
			);

			var separator = CreateSeparator ();
			relativeLayout.Children.Add (separator,
				Constraint.RelativeToParent (parent => { return parent.X; }),
				Constraint.RelativeToView (needStack, (parent,sibling) => { return sibling.Height; }),
				Constraint.RelativeToParent (parent => { return parent.Width; }),
				Constraint.Constant (0.5)
			);

			var haveStack = CreateHaveStack ();
			relativeLayout.Children.Add (haveStack,
				Constraint.RelativeToParent (parent => { return parent.X; }),
				Constraint.RelativeToView (separator, (parent,sibling) => { return sibling.Y + sibling.Height; }),
				Constraint.RelativeToParent (parent => { return parent.Width; }),
				Constraint.RelativeToParent (parent => { return (parent.Height / 2) - 0.25; })
			);

			Content = relativeLayout;
		}