2
Salut j'ai ajouté un polygone à une carte en utilisant:Vérifiez si polygone a été cliqué
//Creating a Polygon
Polygon MyPolygon = new Polygon();
MyPolygon.Points.Add(new Point(0, 0));
MyPolygon.Points.Add(new Point(95, 0));
MyPolygon.Points.Add(new Point(95, 35));
MyPolygon.Points.Add(new Point(10, 35));
MyPolygon.Points.Add(new Point(0, 75)); //
MyPolygon.Stroke = new SolidColorBrush(Colors.Black);
MyPolygon.Fill = new SolidColorBrush(Colors.Black);
//Creating a MapOverlay and adding the Grid to it.
MapOverlay MyOverlay = new MapOverlay();
MyOverlay.Content = MyPolygon;
MyOverlay.GeoCoordinate =
new GeoCoordinate(coordinate.Latitude, coordinate.Longitude);
MyOverlay.PositionOrigin = new Point(0, 1.0);
//Creating a MapLayer and adding the MapOverlay to it
mapLayer.Add(MyOverlay);
MyPolygon.MouseLeftButtonUp += new MouseButtonEventHandler(MyPolygon_Click);
...
private void MyPolygon_Click(object sender, MouseEventArgs e)
{
TextBlock nametext;
nametext = new TextBlock { Text = "1234" };
}
Je dois vérifier si l'utilisateur clique sur ce polygone. Quelqu'un peut-il m'aider avec ça sil-vous-plait?
Avez-vous essayé d'ajouter un MouseUp eventHandler à votre Polygon? –
Oui. J'ai édité ma question pour la montrer mais rien ne se produit quand le polygone est cliqué. – user1853871
Quel cadre utilisez-vous? WPF, Windows Store ou? –