Ejemplo n.º 1
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            this.ViewModel = BindingContext as TestPageAllXamlViewModel;

            //SetupSlidingPanel();


            if (GoogleMapInstance != null)
            {
                Position randomPosition = new Position(5, 5);
                GoogleMapInstance.Pins.Add(new Pin
                {
                    Label    = "Test Pin",
                    Position = randomPosition
                });
                GoogleMapInstance.MoveToRegion(new MapSpan(randomPosition, 0.5, 0.5));

                GoogleMapInstance.WhenAnyValue(x => x.SelectedPin)
                .Subscribe(selectedPin =>
                {
                    if (selectedPin == null)
                    {
                        spTest.HidePanel();
                    }

                    if (selectedPin != null)
                    {
                        spTest.ShowCollapsedPanel();
                    }
                });
            }
        }
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            this.ViewModel = BindingContext as TestPageAllXamlViewModel;

            this.spTest.SetBinding(SlidingUpPanel.PanelRatioProperty, new Binding {
                Path = "PanelRatio"
            });

            this.spTest.WhenPanelRatioChanged        += SpTest_WhenPanelRatioChanged;
            this.spTest.WhenSlidingPanelStateChanged += SpTest_WhenSlidingPanelStateChanged;
            //SetupSlidingPanel();

            if (GoogleMapInstance != null)
            {
                Position randomPosition = new Position(5, 5);
                GoogleMapInstance.Pins.Add(new Pin
                {
                    Label    = "Test Pin Full Ratio",
                    Position = randomPosition
                });
                GoogleMapInstance.Pins.Add(new Pin
                {
                    Label    = "Test Pin Half Ratio",
                    Position = new Position(randomPosition.Latitude + 0.1, randomPosition.Longitude + 0.1)
                });
                GoogleMapInstance.Pins.Add(new Pin
                {
                    Label    = "Test Pin Half Ratio",
                    Position = new Position(randomPosition.Latitude - 0.1, randomPosition.Longitude - 0.1)
                });
                GoogleMapInstance.MoveToRegion(new MapSpan(randomPosition, 0.5, 0.5));

                GoogleMapInstance.WhenAnyValue(x => x.SelectedPin)
                .Subscribe(selectedPin =>
                {
                    if (selectedPin == null)
                    {
                        if (spTest.CurrentState != SlidingPanelState.Expanded)
                        {
                            spTest.HidePanel();
                        }
                        else
                        {
                        }
                    }

                    if (selectedPin != null)
                    {
                        spTest.HidePanel();

                        if (selectedPin.Label == "Test Pin Full Ratio")
                        {
                            this.ViewModel.PanelRatio    = 1;
                            this.ViewModel.HideTitleView = true;
                        }

                        if (selectedPin.Label == "Test Pin Half Ratio")
                        {
                            this.ViewModel.PanelRatio    = 0.6;
                            this.ViewModel.HideTitleView = false;
                        }

                        spTest.ShowCollapsedPanel();
                    }
                });
            }

            primaryFABImage.GestureRecognizers.Add(spTest.TitlePanelTapGesture);
            primaryFABImage.GestureRecognizers.Add(spTest.PanelPanGesture);
        }