示例#1
0
        public ColorMappings()
        {
            InitializeComponent();
            this.BindingContext = this;
            ColorMappingsViewModel viewmodel = new ColorMappingsViewModel();

            (this.Map.Layers[0] as ShapeFileLayer).ItemsSource             = viewmodel.GetDataSource();
            (this.Map.Layers[0] as ShapeFileLayer).LegendSettings.IconSize = new Size(15, 15);

            grid.SizeChanged += Grid_SizeChanged;

            if ((Device.Idiom == TargetIdiom.Tablet || Device.Idiom == TargetIdiom.Desktop) && Device.OS == TargetPlatform.Windows)
            {
                (this.Map.Layers[0] as ShapeFileLayer).LegendSettings.LegendPosition = new Point(850, 400);
            }

            (this.Map.Layers[0] as ShapeFileLayer).ShapeSelected += (object data) => {
                AgricultureData dat = data as AgricultureData;
                if (dat != null)
                {
                    Toast.IsVisible = true;
                    State           = countryLabel.Text = dat.Name;
                    Type            = populationLabel.Text = dat.Type;

                    Device.StartTimer(new TimeSpan(0, 0, 3), () =>
                    {
                        Toast.IsVisible = false;
                        return(false);
                    });
                }
            };
        }
示例#2
0
        private void ShapeLayer_ShapeSelectionChanged(object sender, ShapeSelectedEventArgs e)
        {
            AgricultureData data = e.Data as AgricultureData;

            if (data != null)
            {
                Toast.IsVisible = true;
                stateLabel.Text = data.Name;
                Device.StartTimer(new TimeSpan(0, 0, 3), () =>
                {
                    Toast.IsVisible = false;
                    return(false);
                });
            }
        }