示例#1
0
        void AddContent()
        {
            InitializeChildGrid();
            mainGrid.HorizontalOptions = LayoutOptions.FillAndExpand;
            mainGrid.VerticalOptions   = LayoutOptions.FillAndExpand;
            mainGrid.BackgroundColor   = Color.FromRgb(249, 245, 237);
            mainGrid.Children.Add(childGrid);
            maps = new Syncfusion.SfMaps.XForms.SfMaps();
            Syncfusion.SfMaps.XForms.ImageryLayer layer = new ImageryLayer();
            layer.GeoCoordinates = new Point(38.909804, -77.043442);
            layer.Radius         = 5;
            CustomMarker marker = new CustomMarker();

            marker.Label         = "Washington DC";
            marker.Latitude      = "38.909804";
            marker.Longitude     = "-77.043442";
            layer.MarkerTemplate = mainGrid.Resources["markerTemplate"] as DataTemplate;
            layer.Markers.Add(marker);
            MapMarkerSetting markerSettings = new MapMarkerSetting();

            markerSettings.VerticalAlignment           = MarkerAlignment.Near;
            markerSettings.TooltipSettings.ShowTooltip = true;
            markerSettings.TooltipSettings.ValuePath   = "Label";
            markerSettings.TooltipSettings.FontSize    = 15;
            layer.MarkerSettings = markerSettings;
            if (Device.RuntimePlatform == Device.UWP)
            {
                maps.MinZoom = 2;
            }
            maps.Layers.Add(layer);
            mainGrid.Children.Add(maps);
            stack                   = new StackLayout();
            stack.Orientation       = StackOrientation.Horizontal;
            stack.BackgroundColor   = Color.White;
            stack.HorizontalOptions = LayoutOptions.EndAndExpand;
            stack.VerticalOptions   = LayoutOptions.End;
            Label label1 = new Label();

            label1.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
            label1.Text     = "©";
            label1.Margin   = new Thickness(2);
            stack.Children.Add(label1);

            Label label2 = new Label();

            label2.Margin    = new Thickness(0, 2, 3, 2);
            label2.FontSize  = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
            label2.Text      = "OpenStreetMap contributors.";
            label2.TextColor = Color.DeepSkyBlue;
            Uri uri = new Uri("https://www.openstreetmap.org/copyright");

            label2.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => Launcher.OpenAsync(uri))
            });
            stack.Children.Add(label2);
            mainGrid.Children.Add(stack);
        }
示例#2
0
        void AddContent()
        {
            InitializeChildGrid();
            mainGrid.HorizontalOptions = LayoutOptions.FillAndExpand;
            mainGrid.VerticalOptions   = LayoutOptions.FillAndExpand;
            mainGrid.BackgroundColor   = Color.FromRgb(249, 245, 237);
            mainGrid.Children.Add(childGrid);
            maps  = new Syncfusion.SfMaps.XForms.SfMaps();
            layer = new ImageryLayer();
            layer.GeoCoordinates = new Point(27.1751, 78.0421);
            maps.MaxZoom         = 8;
            maps.MinZoom         = 4;

            layer.DistanceType = DistanceType.KiloMeter;

            if (Device.RuntimePlatform == Device.Android)
            {
                layer.Radius = 1500;
            }
            else
            {
                layer.Radius = 500;
            }


            //layer.MarkerTemplate = mainGrid.Resources["markerTemplate"] as DataTemplate;

            CustomMarker marker = new CustomMarker();

            marker.Latitude  = "20.6843";
            marker.Longitude = "-88.5678";
            marker.Location  = "Mexico";
            layer.Markers.Add(marker);

            marker           = new CustomMarker();
            marker.Location  = "Peru";
            marker.Latitude  = "-13.1631";
            marker.Longitude = "-72.5450";
            layer.Markers.Add(marker);

            marker           = new CustomMarker();
            marker.Location  = "Brazil";
            marker.Latitude  = "-22.9519";
            marker.Longitude = "-43.2106";
            layer.Markers.Add(marker);

            marker           = new CustomMarker();
            marker.Location  = "Rome";
            marker.Latitude  = "41.8902";
            marker.Longitude = "12.4922";
            layer.Markers.Add(marker);

            marker           = new CustomMarker();
            marker.Location  = "Jordan";
            marker.Latitude  = "30.3285";
            marker.Longitude = "35.4444";
            layer.Markers.Add(marker);

            marker           = new CustomMarker();
            marker.Location  = "India";
            marker.Latitude  = "27.1751";
            marker.Longitude = "78.0421";
            layer.Markers.Add(marker);

            marker           = new CustomMarker();
            marker.Location  = "China";
            marker.Latitude  = "40.4319";
            marker.Longitude = "116.5704";
            layer.Markers.Add(marker);

            MapMarkerSetting markerSettings = new MapMarkerSetting();

            markerSettings.IconSize  = 20;
            markerSettings.IconColor = Color.FromHex("#FF2196ef");
            markerSettings.TooltipSettings.TooltipTemplate = mainGrid.Resources["toolTipTemplate"] as DataTemplate;
            markerSettings.TooltipSettings.ShowTooltip     = true;
            markerSettings.TooltipSettings.FontSize        = 15;
            layer.MarkerSettings = markerSettings;

            maps.Layers.Add(layer);
            mainGrid.Children.Add(maps);

            carousel = new Syncfusion.SfCarousel.XForms.SfCarousel();
            carousel.RotationAngle = 0;
            if (Device.RuntimePlatform == Device.UWP)
            {
                carousel.HeightRequest = 150;
                carousel.ItemHeight    = 150;
            }
            else
            {
                carousel.HeightRequest = 125;
                carousel.ItemHeight    = 125;
            }

            carousel.VerticalOptions = LayoutOptions.EndAndExpand;
            carousel.Margin          = new Thickness(0, 0, 0, 5);

            carousel.ItemTemplate      = mainGrid.Resources["carouselTemplate"] as DataTemplate;
            carousel.SelectionChanged += Carousel_SelectionChanged;
            carousel.ItemsSource       = viewModel.RotatorItems;
            carousel.SelectedIndex     = 5;
            mainGrid.Children.Add(carousel);

            stack                   = new StackLayout();
            stack.Orientation       = StackOrientation.Horizontal;
            stack.BackgroundColor   = Color.White;
            stack.HorizontalOptions = LayoutOptions.EndAndExpand;
            stack.VerticalOptions   = LayoutOptions.End;
            Label label1 = new Label();

            label1.FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
            label1.Text     = "©";
            label1.Margin   = new Thickness(2);
            stack.Children.Add(label1);

            Label label2 = new Label();

            label2.Margin    = new Thickness(0, 2, 3, 2);
            label2.FontSize  = Device.GetNamedSize(NamedSize.Micro, typeof(Label));
            label2.Text      = "OpenStreetMap contributors.";
            label2.TextColor = Color.DeepSkyBlue;
            Uri uri = new Uri("https://www.openstreetmap.org/copyright");

            label2.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => Launcher.OpenAsync(uri))
            });
            stack.Children.Add(label2);
            mainGrid.Children.Add(stack);
        }