点击事件处理程序c#windows10
我想添加一个点击事件,在我的地图上打开关于点击pin的信息(在文本框或弹出窗口或任何可能的地方) 我有一个地图和一个在上面添加pin(mapicon)的方法,我的问题是我不知道如何使用pin作为按钮来打开一些东西来显示关于点击的pin的信息,关闭/清理它以便向用户打开一个新的 方法如下:点击事件处理程序c#windows10,c#,windows,icons,maps,C#,Windows,Icons,Maps,我想添加一个点击事件,在我的地图上打开关于点击pin的信息(在文本框或弹出窗口或任何可能的地方) 我有一个地图和一个在上面添加pin(mapicon)的方法,我的问题是我不知道如何使用pin作为按钮来打开一些东西来显示关于点击的pin的信息,关闭/清理它以便向用户打开一个新的 方法如下: private void addgreenpin(双纬度、双经度、字符串名称){ 我一直在尝试: MapControl1.MapElementClick += new TappedEventHandler(In
private void addgreenpin(双纬度、双经度、字符串名称){
我一直在尝试:
MapControl1.MapElementClick += new TappedEventHandler(Info);
您可以将XAML内容添加到地图中来代替MapIcon,如下所示:
var pin = new Grid();
pin.Tapped += Pin_Tapped; //Binding tap event for current pin.
pin.Children.Add(new Ellipse()
{
Fill = new SolidColorBrush(Colors.DodgerBlue),
Stroke = new SolidColorBrush(Colors.White),
StrokeThickness = 1,
Width = 20,
Height = 20,
});
MapControl.SetLocation(pin, <GeoPoint_Where_You_Need_The_Pin>);
mapControlName.Children.Add(pin);
private async void Pin_Tapped(object sender, TappedRoutedEventArgs e)
{
// DO YOUR STUFF HERE
}
希望这有帮助。您可以将XAML内容添加到地图中,例如:
var pin = new Grid();
pin.Tapped += Pin_Tapped; //Binding tap event for current pin.
pin.Children.Add(new Ellipse()
{
Fill = new SolidColorBrush(Colors.DodgerBlue),
Stroke = new SolidColorBrush(Colors.White),
StrokeThickness = 1,
Width = 20,
Height = 20,
});
MapControl.SetLocation(pin, <GeoPoint_Where_You_Need_The_Pin>);
mapControlName.Children.Add(pin);
private async void Pin_Tapped(object sender, TappedRoutedEventArgs e)
{
// DO YOUR STUFF HERE
}
希望这有帮助