1

我一直在写一篇关于 Windows Phone 上的地图的文章。我将图钉默认添加到地图中,其内容是图像。我想在点击或单击图钉时显示信息,但我不知道该怎么做。我刚刚考虑过使用工具提示来显示信息,但我做不到。这是我的 createpushpin 函数。你能帮助我吗?谢谢你的一切!

    private void CreateNewPushpin(object selectedItem)
    {

        var pushpinPrototype = selectedItem as Pushpinsmodel;
        var pushpinicon = pushpinPrototype.Icon;

        Pushpin pushpins = new Pushpin() { Tag = adress.Name };
        pushpins.Background = new SolidColorBrush(Colors.Green);
        pushpins.Location = new GeoCoordinate(lad, long);
        ImageBrush image = new ImageBrush() { 
         ImageSource = new System.Windows.Media.Imaging.BitmapImage
        (pushpinicon)};

        Ellipse elip = new Ellipse()
        {
            Fill = image,

            Name = adress.Name,
            StrokeThickness = 10,
            Height = 30,
            Width = 30
        };
            pushpins.Content = elip;
            var tooltipText = new ToolTip { Content = adress.Name};
        ToolTipService.SetToolTip(pushpins, tooltipText);
        map1.Children.Add(pushpins); 
        listpushpin.Add(pushpins);
              this.map1.SetView(pushpins.Location, 18.0);

}

4

0 回答 0