/// <summary> /// Creates the mapview instance and hence Creates the view. /// </summary> async void CreateView() { var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Google }; autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); var HitechCity = new Position(17.4474, 78.3762); var mapView = new TKCustomMap(MapSpan.FromCenterAndRadius(HitechCity, Distance.FromKilometers(2))); mapView.SetBinding(TKCustomMap.CustomPinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); mapView.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); mapView.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); mapView.SetBinding(TKCustomMap.SelectedPinProperty, "SelectedPin"); mapView.SetBinding(TKCustomMap.RoutesProperty, "Routes"); mapView.SetBinding(TKCustomMap.CirclesProperty, "Circles"); mapView.SetBinding(TKCustomMap.CalloutClickedCommandProperty, "CalloutClickedCommand"); mapView.SetBinding(TKCustomMap.PolylinesProperty, "Lines"); mapView.SetBinding(TKCustomMap.PolygonsProperty, "Polygons"); mapView.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.IsRegionChangeAnimated = true; mapView.IsShowingUser = true; autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); //Content = mapView; //FloatingActionButton normalFab = new FloatingActionButton(); //normalFab.Source = "plus.png"; //normalFab.Size = FabSize.Normal; //normalFab.RippleColor = Color.Gray; _baseLayout.Children.Add( mapView, Constraint.RelativeToView(autoComplete, (r, v) => v.X), Constraint.RelativeToView(autoComplete, (r, v) => autoComplete.HeightOfSearchBar), heightConstraint: Constraint.RelativeToParent((r) => r.Height - autoComplete.HeightOfSearchBar), widthConstraint: Constraint.RelativeToView(autoComplete, (r, v) => v.Width)); _baseLayout.Children.Add( autoComplete, Constraint.Constant(0), Constraint.Constant(0)); //_baseLayout.Children.Add( // normalFab, // xConstraint: Constraint.RelativeToParent((parent) => { return (parent.Width - normalFab.Width) - 16; }), // yConstraint: Constraint.RelativeToParent((parent) => { return (parent.Height - normalFab.Height) - 16; }) //); //normalFab.SizeChanged += (sender, args) => { _baseLayout.ForceLayout(); }; }
private void CreateView() { var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Native }; autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); mapView = new TKCustomMap(MapSpan.FromCenterAndRadius(CurrentPosition, Distance.FromKilometers(1))) { MapCenter = CurrentPosition, MapType = MapType.Hybrid, IsShowingUser = true, IsRegionChangeAnimated = true }; mapView.SetBinding(TKCustomMap.CustomPinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); mapView.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); mapView.SetBinding(TKCustomMap.MapCenterProperty, "MapCenter"); mapView.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); mapView.SetBinding(TKCustomMap.SelectedPinProperty, "SelectedPin"); mapView.SetBinding(TKCustomMap.RoutesProperty, "Routes"); mapView.SetBinding(TKCustomMap.PinDragEndCommandProperty, "DragEndCommand"); mapView.SetBinding(TKCustomMap.CirclesProperty, "Circles"); mapView.SetBinding(TKCustomMap.CalloutClickedCommandProperty, "CalloutClickedCommand"); mapView.SetBinding(TKCustomMap.PolylinesProperty, "Lines"); mapView.SetBinding(TKCustomMap.PolygonsProperty, "Polygons"); mapView.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapView.SetBinding(TKCustomMap.RouteClickedCommandProperty, "RouteClickedCommand"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.SetBinding(TKCustomMap.TilesUrlOptionsProperty, "TilesUrlOptions"); mapView.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); _baseLayout.Children.Add( mapView, Constraint.RelativeToView(autoComplete, (r, v) => v.X), Constraint.RelativeToView(autoComplete, (r, v) => autoComplete.HeightOfSearchBar), heightConstraint: Constraint.RelativeToParent(r => r.Height - autoComplete.HeightOfSearchBar), widthConstraint: Constraint.RelativeToView(autoComplete, (r, v) => v.Width)); _baseLayout.Children.Add( autoComplete, Constraint.Constant(0), Constraint.Constant(0)); }
private async void CreateView() { var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Google }; autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); var newYork = new Position(40.7142700, -74.0059700); var mapView = new TKCustomMap(MapSpan.FromCenterAndRadius(newYork, Distance.FromKilometers(2))); mapView.IsShowingUser = true; mapView.SetBinding(TKCustomMap.CustomPinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); mapView.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); mapView.SetBinding(TKCustomMap.MapCenterProperty, "MapCenter"); mapView.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); mapView.SetBinding(TKCustomMap.SelectedPinProperty, "SelectedPin"); mapView.SetBinding(TKCustomMap.RoutesProperty, "Routes"); mapView.SetBinding(TKCustomMap.PinDragEndCommandProperty, "DragEndCommand"); mapView.SetBinding(TKCustomMap.CirclesProperty, "Circles"); mapView.SetBinding(TKCustomMap.CalloutClickedCommandProperty, "CalloutClickedCommand"); mapView.SetBinding(TKCustomMap.PolylinesProperty, "Lines"); mapView.SetBinding(TKCustomMap.PolygonsProperty, "Polygons"); mapView.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapView.SetBinding(TKCustomMap.RouteClickedCommandProperty, "RouteClickedCommand"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.SetBinding(TKCustomMap.TilesUrlOptionsProperty, "TilesUrlOptions"); mapView.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); mapView.IsRegionChangeAnimated = true; autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); this.Content = mapView; //this._baseLayout.Children.Add( // mapView, // Constraint.RelativeToView(autoComplete, (r, v) => v.X), // Constraint.RelativeToView(autoComplete, (r, v) => autoComplete.HeightOfSearchBar), // heightConstraint: Constraint.RelativeToParent((r) => r.Height - autoComplete.HeightOfSearchBar), // widthConstraint: Constraint.RelativeToView(autoComplete, (r, v) => v.Width)); //this._baseLayout.Children.Add( // autoComplete, // Constraint.Constant(0), // Constraint.Constant(0)); }
void CreateView() { var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Native }; autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); mapView.SetBinding(TKCustomMap.IsClusteringEnabledProperty, "IsClusteringEnabled"); mapView.SetBinding(TKCustomMap.GetClusteredPinProperty, "GetClusteredPin"); mapView.SetBinding(TKCustomMap.PinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); mapView.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); mapView.MapType = MapType.Hybrid; mapView.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); mapView.SetBinding(TKCustomMap.SelectedPinProperty, "SelectedPin"); mapView.SetBinding(TKCustomMap.RoutesProperty, "Routes"); mapView.SetBinding(TKCustomMap.PinDragEndCommandProperty, "DragEndCommand"); mapView.SetBinding(TKCustomMap.CirclesProperty, "Circles"); mapView.SetBinding(TKCustomMap.CalloutClickedCommandProperty, "CalloutClickedCommand"); mapView.SetBinding(TKCustomMap.PolylinesProperty, "Lines"); mapView.SetBinding(TKCustomMap.PolygonsProperty, "Polygons"); mapView.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapView.SetBinding(TKCustomMap.RouteClickedCommandProperty, "RouteClickedCommand"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.SetBinding(TKCustomMap.TilesUrlOptionsProperty, "TilesUrlOptions"); mapView.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); mapView.IsRegionChangeAnimated = true; mapView.IsShowingUser = true; autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); Content = mapView; //_baseLayout.Children.Add( // mapView, // Constraint.RelativeToView(autoComplete, (r, v) => v.X), // Constraint.RelativeToView(autoComplete, (r, v) => autoComplete.HeightOfSearchBar), // heightConstraint: Constraint.RelativeToParent((r) => r.Height - autoComplete.HeightOfSearchBar), // widthConstraint: Constraint.RelativeToView(autoComplete, (r, v) => v.Width)); //_baseLayout.Children.Add( // autoComplete, // Constraint.Constant(0), // Constraint.Constant(0)); }
public AddRoutePage(ObservableCollection <TKRoute> routes, ObservableCollection <TKCustomMapPin> pins, MapSpan bounds) { InitializeComponent(); var googleImage = new Image { Source = "powered_by_google_on_white.png" }; var searchFrom = new PlacesAutoComplete(true) { ApiToUse = PlacesAutoComplete.PlacesApi.Google, Bounds = bounds, Placeholder = "From" }; searchFrom.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "FromSelectedCommand"); var searchTo = new PlacesAutoComplete(true) { ApiToUse = PlacesAutoComplete.PlacesApi.Google, Bounds = bounds, Placeholder = "To" }; searchTo.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "ToSelectedCommand"); if (Device.OS == TargetPlatform.Android) { this._baseLayout.Children.Add( googleImage, Constraint.Constant(10), Constraint.RelativeToParent(l => l.Height - 30)); } this._baseLayout.Children.Add( searchTo, yConstraint: Constraint.RelativeToView(searchFrom, (l, v) => searchFrom.HeightOfSearchBar + 10)); this._baseLayout.Children.Add( searchFrom, Constraint.Constant(0), Constraint.Constant(10)); this.BindingContext = new AddRouteViewModel(routes, pins, bounds); }
public AddRoutePage(ObservableCollection <TKRoute> routes, ObservableCollection <TKCustomMapPin> pins, MapSpan bounds) { InitializeComponent(); var searchFrom = new PlacesAutoComplete(false) { ApiToUse = PlacesAutoComplete.PlacesApi.Native, Bounds = bounds, Placeholder = "From" }; searchFrom.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "FromSelectedCommand"); var searchTo = new PlacesAutoComplete(false) { ApiToUse = PlacesAutoComplete.PlacesApi.Native, Bounds = bounds, Placeholder = "To" }; searchTo.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "ToSelectedCommand"); if (Device.OS == TargetPlatform.Android) { _baseLayout.Children.Add( null, Constraint.Constant(10), Constraint.RelativeToParent(l => l.Height - 30)); } _baseLayout.Children.Add( searchTo, yConstraint: Constraint.RelativeToView(searchFrom, (l, v) => searchFrom.HeightOfSearchBar + 10)); _baseLayout.Children.Add( searchFrom, Constraint.Constant(0), Constraint.Constant(10)); //this.BindingContext = new AddRoutePageModel(routes, pins, bounds); }
public void ChoosePlace(string place) { ClickOn(PlacesAutoComplete.First(x => x.Text == place)); }