地图自定义图钉未显示 [英] Maps custom pushpins not showing

查看:95
本文介绍了地图自定义图钉未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

将自定义图钉放入原生地图时遇到严重问题。我正在加载地图,在该位置获取用户位置,缩放和中心地图。之后,我在该点周围加载位置并放置自定义推针(位图图像​​)。可以有更多类型
的位置,以便根据不同的类型更改图像。在初始加载时一切正常,但随后我在地图上移动事件。因此,当移动时,我会动态获取更多位置,并添加更多引脚。但问题来了。在
初始放置引脚之后,所有引脚之后只能看到与初始引脚相同的颜色。我调试每一行,所有似乎都应该工作,但是其他类型的图钉是不可见的。

I have serious problem with putting custom pushpins to native map. I'm loading map, getting user locations, zoom and center map on that location. After that I load locations around that point and put custom push pin (bitmap image). There can be more type of locations so that images are changed depending on different type. On initial load all works fine, but then I have  event on moving around map. So when move, I dynamically getting more locations, and putting more pins. But here comes problem. After initial putting pins, all after that pins are only visible of same colors as one putted on initial. I debug every line, and all seems to works as should, but pushpins of some another types aren't visible.

以下是放置引脚的代码示例:

Here is code sample of putting pins:

Image slika = new Image();
            BitmapImage  myBitmapImage = new BitmapImage(new Uri("Images/markers/test_1.png", UriKind.Relative));

            slika.Source = myBitmapImage;

            slika.Tag = test.id.ToString();
            slika.Height = 45;
            slika.Width = 45;
            slika.Opacity = 50;
            slika.Tap += slika_Tap;

            GeoCoordinate testGeoCoordinate = new GeoCoordinate(test.latitude, test.longitude);

            MapOverlay myLocationOverlay = new MapOverlay();

            myLocationOverlay.Content = slika;

            myLocationOverlay.PositionOrigin = new System.Windows.Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = testGeoCoordinate;

            MapLayer myLocationLayer = new MapLayer();
            myLocationLayer.Add(myLocationOverlay);
                     this.mapYourLocation2.Layers.Add(myLocationLayer);


发生了什么问题?

What problem is happening?

推荐答案

Hi lobuljen,

Hi lobuljen,

>>  其他类型的图钉不可见。

>>  pushpins of some another types aren't visible.

您可以尝试告诉我上述消息的含义吗? 由于我没有您的完整代码,因此我在我身边测试了以下代码,它的效果非常好。

Could you please try to tell me what the above message means? Since I do not have your full code, then I have tested the following code in my side, it works very well.

所以如果你可以尝试在这里发布你的完整代码会更好。

So it will be better if you can try to post your full code in here.

最好的问候,

Amy Peng

Best Regards,
Amy Peng


这篇关于地图自定义图钉未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆