Exemplo n.º 1
0
        public MainPage()
        {
            _viewModel = new MainPageViewModel (new VolleyballLocationService ());
            BindingContext = _viewModel;

            BackgroundColor = Color.White;

            //Coordinates for the starting point of the map
            const double latitude = 41.788081;
            const double longitude = -87.831573;

            var location = new Position (latitude, longitude);

            var map = new CustomMap (MapSpan.FromCenterAndRadius (location, Distance.FromMiles (20))){ IsShowingUser = true };

            map.BindingContext = _viewModel;
            map.SetBinding<MainPageViewModel> (CustomMap.CustomPinsProperty, x => x.VolleyballLocations);

            Content = new CustomMapContentView (map);
        }
        public CustomMapContentView(CustomMap customMap)
        {
            _customMap = customMap;

            //The Heights of the rows are overwritten
            _mapGrid = new Grid {
                RowDefinitions = new RowDefinitionCollection {
                    new RowDefinition (), new RowDefinition ()
                },
                ColumnDefinitions = new ColumnDefinitionCollection {
                    new ColumnDefinition {
                        Width = new GridLength (1, GridUnitType.Star)
                    }
                }, RowSpacing = 0
            };

            //Bind the footer to the ShowFooter property
            _mapGrid.BindingContext = this;

            Content = _mapGrid;
        }