Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _mapView = new BindingMKMapView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _delegate = new LocationTrackingMapDelegate(_mapView);

            _toggleButton = new UIButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Black
            };
            _toggleButton.SetTitle("Pins", UIControlState.Normal);

            View.AddSubviews(_mapView, _toggleButton);

            View.AddConstraints(new FluentLayout[]
            {
                _toggleButton.AtBottomOf(View),
                _toggleButton.AtLeftOf(View),
                _toggleButton.AtRightOf(View),

                _mapView.AtTopOf(View),
                _mapView.AtLeftOf(View),
                _mapView.AtRightOf(View),
                _mapView.Above(_toggleButton)
            });

            var bindingSet = this.CreateBindingSet <LocationTrackingView, LocationTrackingViewModel>();

            bindingSet.Bind(_mapView).For(v => v.UserCurrentLocation).To(vm => vm.UserLocation);
            bindingSet.Bind(_mapView).For(v => v.CenterMapLocation).To(vm => vm.UserLocation);
            bindingSet.Bind(_mapView).For(v => v.ShowsUserLocation).To(vm => vm.CanTrackLocation);
            bindingSet.Bind(_delegate).For(v => v.AnnotationSource).To(vm => vm.Pins);
            bindingSet.Bind(_toggleButton).To(vm => vm.NavigateToMapPinsCommand);
            bindingSet.Bind(_delegate).For(v => v.LocationChanged).To(vm => vm.UserLocationChangedCommand);

            _mapView.Delegate = _delegate;

            bindingSet.Apply();
        }
Exemple #2
0
        private void InitializeSubviews()
        {
            _mapView = new BindingMKMapView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                ScrollEnabled          = true,
                UserInteractionEnabled = true,
                Delegate  = _mapDelegate,
                ZoomLevel = 72.25
            };
            _mapDelegate = new ExampleBindingMapDelegate(_mapView);

            _info = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _latitude = new UITextView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                TextAlignment = UITextAlignment.Right
            };

            _longitude = new UITextView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _colon = new UITextView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = ":",
            };

            _toggleButton = new UIButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Black
            };
            _toggleButton.SetTitle("User Location", UIControlState.Normal);

            View.AddSubviews(_mapView, _info, _toggleButton);
            _info.AddSubviews(_latitude, _longitude, _colon);
        }
Exemple #3
0
 public MvxBindingMkMapViewDelegate(BindingMKMapView mapView) : base(mapView)
 {
 }
Exemple #4
0
 public ExampleBindingMapDelegate(BindingMKMapView mapView) : base(mapView)
 {
 }
Exemple #5
0
 public LocationTrackingMapDelegate(BindingMKMapView mapView) : base(mapView)
 {
 }