protected void MapInit() { //var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Native }; //autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); var myCustomMap = new TKCustomMap(); //(MapSpan.FromCenterAndRadius(position, Distance.FromKilometers(1)).WithZoom(8)); myCustomMap.SetBinding(TKCustomMap.CustomPinsProperty, "Pins"); myCustomMap.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); myCustomMap.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); myCustomMap.SetBinding(TKCustomMap.MapCenterProperty, "MapCenter"); myCustomMap.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); myCustomMap.SetBinding(TKCustomMap.SelectedPinProperty, "SelectedPin"); myCustomMap.SetBinding(TKCustomMap.RoutesProperty, "Routes"); myCustomMap.SetBinding(TKCustomMap.PinDragEndCommandProperty, "DragEndCommand"); myCustomMap.SetBinding(TKCustomMap.CirclesProperty, "Circles"); myCustomMap.SetBinding(TKCustomMap.CalloutClickedCommandProperty, "CalloutClickedCommand"); myCustomMap.SetBinding(TKCustomMap.PolylinesProperty, "Lines"); myCustomMap.SetBinding(TKCustomMap.PolygonsProperty, "Polygons"); myCustomMap.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); myCustomMap.SetBinding(TKCustomMap.RouteClickedCommandProperty, "RouteClickedCommand"); myCustomMap.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); myCustomMap.SetBinding(TKCustomMap.TilesUrlOptionsProperty, "TilesUrlOptions"); myCustomMap.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); myCustomMap.IsRegionChangeAnimated = true; myCustomMap.IsShowingUser = true; //autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); this.Content = myCustomMap; }
public async void INIT() { //imgIcon.RotateXTo(251 * 360, duration) //imgIcon.RotateYTo(199 * 360, duration 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; stkMap.Children.Add(mapView); }
/// <summary> /// Unregisters all collections /// </summary> private void UnregisterCollections(TKCustomMap map) { this.UnregisterCollection(map.CustomPins, this.OnCustomPinsCollectionChanged, this.OnPinPropertyChanged); this.UnregisterCollection(map.Routes, this.OnRouteCollectionChanged, this.OnRoutePropertyChanged); this.UnregisterCollection(map.Polylines, this.OnLineCollectionChanged, this.OnLinePropertyChanged); this.UnregisterCollection(map.Circles, this.CirclesCollectionChanged, this.CirclePropertyChanged); this.UnregisterCollection(map.Polygons, this.OnPolygonsCollectionChanged, this.OnPolygonPropertyChanged); }
public SamplePage(double longitude, double latitude, Appointment appointment) { InitializeComponent(); appt = appointment; location = new Position(latitude, longitude); mapView = new TKCustomMap(MapSpan.FromCenterAndRadius(location, Distance.FromKilometers(4))); BindingContext = new SampleViewModel(longitude, latitude, appt); CreateView(); }
/// <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(); }; }
async void setUI() { var locator = CrossGeolocator.Current; var newYork = new Position(40.7142700, -74.0059700); //if (locator.IsGeolocationAvailable && locator.IsGeolocationEnabled) //{ // locator.DesiredAccuracy = 50; // await locator.StartListeningAsync(new TimeSpan(1000), 5000, false); // var position = await locator.GetPositionAsync(timeout: new TimeSpan(30000)); // var lat = position.Latitude; // var lng = position.Longitude; // newYork = new Position(position.Latitude, position.Longitude); // mapViewTK.MapRegion = MapSpan.FromCenterAndRadius(new Position(lat, lng), Distance.FromKilometers(0.4)); // mapViewTK.Pins = new List<TKCustomMapPin>(new[] // { // new TKCustomMapPin{Title = "Home Location",Position = new Position(lat, lng),ShowCallout = true} // }); // var result = await locator.StopListeningAsync(); //} var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Google }; autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); var mapViewTK = new TKCustomMap(MapSpan.FromCenterAndRadius(newYork, Distance.FromKilometers(2))); mapViewTK.SetBinding(TKCustomMap.IsClusteringEnabledProperty, "IsClusteringEnabled"); mapViewTK.SetBinding(TKCustomMap.GetClusteredPinProperty, "GetClusteredPin"); mapViewTK.SetBinding(TKCustomMap.PinsProperty, "Pins"); mapViewTK.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); mapViewTK.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); mapViewTK.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); mapViewTK.SetBinding(TKCustomMap.SelectedPinProperty, "SelectedPin"); mapViewTK.SetBinding(TKCustomMap.RoutesProperty, "Routes"); mapViewTK.SetBinding(TKCustomMap.PinDragEndCommandProperty, "DragEndCommand"); mapViewTK.SetBinding(TKCustomMap.CirclesProperty, "Circles"); mapViewTK.SetBinding(TKCustomMap.CalloutClickedCommandProperty, "CalloutClickedCommand"); mapViewTK.SetBinding(TKCustomMap.PolylinesProperty, "Lines"); mapViewTK.SetBinding(TKCustomMap.PolygonsProperty, "Polygons"); mapViewTK.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapViewTK.SetBinding(TKCustomMap.RouteClickedCommandProperty, "RouteClickedCommand"); mapViewTK.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapViewTK.SetBinding(TKCustomMap.TilesUrlOptionsProperty, "TilesUrlOptions"); mapViewTK.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); mapViewTK.IsRegionChangeAnimated = true; autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); Content = mapViewTK; }
private void CreateView() { var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Native }; 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)); }
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 void CreateView() { var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Native }; autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); var mapView = new TKCustomMap(); 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.SetBinding(TKCustomMap.UserLocationChangedCommandProperty, "UserLocationChangedCommand"); mapView.IsRegionChangeAnimated = true; autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); 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)); }
public Game(int numberOfQuestions, String category, bool isTimeGame) { InitializeComponent(); this.numberOfQuestions = numberOfQuestions; this.category = category; this.isTimeGame = isTimeGame; curQuestionNr = 0; map = new TKCustomMap(MapSpan.FromCenterAndRadius(new Position(48.286998, 14.294665), Distance.FromKilometers(5))); map.MapType = MapType.Satellite; map.BindingContext = new MapViewModel(); map.SetBinding(TKCustomMap.CustomPinsProperty, "Pins"); map.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); MainGrid.Children.Insert(0, map); contentViewRemainingTime.IsVisible = isTimeGame; }
public void SetUp() { mapView = new TKCustomMap(MapSpan.FromCenterAndRadius(new Position(-33.311836, 26.520642), Distance.FromKilometers(2))); mapView.SetBinding(TKCustomMap.IsClusteringEnabledProperty, "IsClusteringEnabled"); mapView.SetBinding(TKCustomMap.GetClusteredPinProperty, "GetClusteredPin"); mapView.SetBinding(TKCustomMap.PinsProperty, "Pins"); 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.RouteClickedCommandProperty, "RouteClickedCommand"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); mapView.IsRegionChangeAnimated = true; mapView.IsShowingUser = true; }
public void CreateView() { var Lund = new Position(55.7047, -13.1910); var mapView = new TKCustomMap(MapSpan.FromCenterAndRadius(Lund, Distance.FromKilometers(2))); mapView.SetBinding(TKCustomMap.PinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); mapView.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); mapView.SetBinding(TKCustomMap.SelectedPinProperty, "SelectedPin"); mapView.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapView.SetBinding(TKCustomMap.TilesUrlOptionsProperty, "TilesUrlOptions"); mapView.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); mapView.IsRegionChangeAnimated = true; mapView.IsShowingUser = true; MapRelativeLayout.Children.Add( mapView, Constraint.Constant(0), Constraint.Constant(0)); }
private async void CreateView() { //var pos = new GeoLocationProvider(); //pos.GetLocation(); //var latlong = pos.GetLatLong(); var currentPostion = new TK.CustomMap.Position(-33.311836, 26.520642); //deafualt location is the Drama Department later this will be changedd to use current location check vars above var mapView = new TKCustomMap(TK.CustomMap.MapSpan.FromCenterAndRadius(currentPostion, TK.CustomMap.Distance.FromKilometers(2))); mapView.IsShowingUser = true; mapView.SetBinding(TKCustomMap.PinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); mapView.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); //mapView.SetBinding(TKCustomMap.MapCenterPropert, "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, nameof(currentPostion)); mapView.SetBinding(TKCustomMap.RouteClickedCommandProperty, "RouteClickedCommand"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.SetBinding(TKCustomMap.TilesUrlOptionsProperty, "TilesUrlOptions"); mapView.SetBinding(TKCustomMap.MapFunctionsProperty, "MapFunctions"); mapView.IsRegionChangeAnimated = true; 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)); }
private void CreateView() { var autoComplete = new PlacesAutoComplete { ApiToUse = PlacesAutoComplete.PlacesApi.Native }; autoComplete.SetBinding(PlacesAutoComplete.PlaceSelectedCommandProperty, "PlaceSelectedCommand"); var mapView = new TKCustomMap(); 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.PolygonsProperty, "Polygons"); mapView.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapView.SetBinding(TKCustomMap.RouteClickedCommandProperty, "RouteClickedCommand"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.AnimateMapCenterChange = true; autoComplete.SetBinding(PlacesAutoComplete.BoundsProperty, "MapRegion"); 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)); }
public DashBoard() { InitializeComponent(); Title = "Find Nearby "; mapView = new TKCustomMap(MapSpan.FromCenterAndRadius(new Position(17.4354, 78.3827), Distance.FromKilometers(1))); mapView.SetBinding(TKCustomMap.PinSelectedCommandProperty, "PinSelectedCommand"); mapView.SetBinding(TKCustomMap.MapRegionProperty, "MapRegion"); mapView.SetBinding(TKCustomMap.CustomPinsProperty, "CustomPins"); //mapView.SetBinding(TKCustomMap.CustomPinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.RoutesProperty, "Routes"); //mapView.SetBinding(TKCustomMap.PolylinesProperty,"Polylines"); //mapView.SetBinding(TKCustomMap.PolylinesProperty, "Lines"); //mapView.SetBinding(TKCustomMap.CustomPinsProperty, "Pins"); mapView.SetBinding(TKCustomMap.RouteCalculationFinishedCommandProperty, "RouteCalculationFinishedCommand"); mapView.IsShowingUser = true; stkMap.Children.Add(mapView); var DbVM = new DashBoardViewModel(); //lstOfResults.IsPullToRefreshEnabled = true; //lstOfResults.SetBinding(ListView.IsRefreshingProperty,nameof(DbVM.IsBusy)); //lstOfResults.RefreshCommand = DbVM.ListRefreshCommand; this.BindingContext = DbVM; }
public MapView() { InitializeComponent(); var HitechCity = new Position(17.4474, 78.3762); var map = new TKCustomMap(MapSpan.FromCenterAndRadius(HitechCity, Distance.FromKilometers(2))); map.SetBinding(TKCustomMap.MapTypeProperty, "MapType"); map.SetBinding(TKCustomMap.IsShowingUserProperty, "UserLocation"); map.SetBinding(TKCustomMap.ShowTrafficProperty, "ShowTraffic"); map.SetBinding(TKCustomMap.HasScrollEnabledProperty, "ScrolledEnabled"); map.SetBinding(TKCustomMap.HasZoomEnabledProperty, "ZoomEnabled"); map.SetBinding(TKCustomMap.MapClickedCommandProperty, "MapClickedCommand"); map.SetBinding(TKCustomMap.MapLongPressCommandProperty, "MapLongPressCommand"); buttonTakeSnapshot.Clicked += async(sender, e) => { var vByte = await map.GetSnapshot(); MemoryStream stream = new MemoryStream(vByte); imageSnapshot.Source = ImageSource.FromStream(() => stream); }; ////////////////////// Set Pin ///////////////////////////////////////// var position1 = new Position(17.4474, 78.3762); var position2 = new Position(17.4354, 78.3827); var position3 = new Position(17.4375, 78.4483); var pin1 = new Pin { Type = PinType.Place, Position = position1, Label = "Hitech City", Address = "www.intilaq.tn", }; var pin2 = new Pin { Type = PinType.Place, Position = position2, Label = "Inorbit Mall", Address = "www.groupe-telnet.com" }; var pin3 = new Pin { Type = PinType.Place, Position = position3, Label = "Ameerpet", Address = "www.kromberg-schubert.com" }; map.Pins.Add(pin1); map.Pins.Add(pin2); map.Pins.Add(pin3); map.MoveToRegion(MapSpan.FromCenterAndRadius(position2, Distance.FromMeters((300)))); // Get geocode buttonGeocode.Clicked += async(sender, e) => { var geocoder = new Geocoder(); var positions = await geocoder.GetPositionsForAddressAsync(entryAddress.Text); if (positions.Count() > 0) { var pos = positions.First(); var pin = new Pin { Type = PinType.Place, Position = pos, Label = "Gachibowli", Address = "Hyderabad", }; map.Pins.Add(pin); map.MoveToRegion(MapSpan.FromCenterAndRadius(pos, Distance.FromMiles((.3)))); var reg = map.VisibleRegion; var format = "0.00"; } else { await this.DisplayAlert("Not found", "Geocoder returns no results", "Close"); } }; mapLayout.Children.Add(map); var vm = new ViewModel.MapViewViewModel(); this.BindingContext = vm; }