Пример #1
0
        private void Marker_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Marker marker = sender as Marker;

            switch (e.PropertyName)
            {
            case "Center": markers[marker].Position = new LatLng(marker.Center.Latitude, marker.Center.Longitude); break;

            case "Icon":
            {
                if (!string.IsNullOrEmpty(marker.Icon))
                {
                    markers[marker].SetIcon(BitmapDescriptorFactory.FromResource(ResourceManager.GetDrawableByName(marker.Icon)));
                }
                break;
            }

            case "Title": markers[marker].Title = marker.Title; break;

            case "Content": markers[marker].Snippet = marker.Icon; break;

            case "Draggable": markers[marker].Draggable = marker.Draggable; break;
            }
            if (e.PropertyName == "Center" && marker.Id != null && marker.Label != null && markers.Any(m => m.Key.Id == marker.Id + "-Label"))
            {
                var labelMarker = markers.FirstOrDefault(m => m.Key.Id == marker.Id + "-Label");
                if (labelMarker.Key != null)
                {
                    markers[labelMarker.Key].Position = new LatLng(marker.Center.Latitude, marker.Center.Longitude);
                }
            }
        }