Win 8 App:Bing Maps绑定位置 [英] Win 8 App: Bing Maps Binding Location

查看:114
本文介绍了Win 8 App:Bing Maps绑定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绑定Bing地图中的经度和纬度值.但这是行不通的.如果我在xaml中编码值,则可以正常工作.但是通过绑定,地图不会居中.

I want to bind the Longitude and Latidute value from a Bing Map. But that doesn't work. if I code the values in the xaml it works fine. But with the binding the Map does not center.

这是我的例子:

<Maps:Map ZoomLevel="7" x:Name="myMap" Credentials="my_Code">
                    <Maps:Map.Center>
                        <Maps:Location Latitude="{Binding Maps.Latitude}" Longitude="{Binding Maps.Longitude}" />
                    </Maps:Map.Center>
                    <Maps:Map.Children>
                        <Maps:Pushpin>
                            <Maps:MapLayer.Position>
                                <Maps:Location Latitude="{Binding Maps.Latitude}" Longitude="{Binding Maps.Longitude}" />
                            </Maps:MapLayer.Position>
                        </Maps:Pushpin>
                    </Maps:Map.Children>
                </Maps:Map>

在地图上标记了位置,但地图未将标记位置居中.如果我这样做,它会起作用:

The position is marked in the map but the map does not center the marked position. If I do this it works:

<Maps:Map ZoomLevel="7" x:Name="myMap" Credentials="my_Code">
                    <Maps:Map.Center>
                        <Maps:Location Latitude="25" Longitude="25" />
                    </Maps:Map.Center>
                    <Maps:Map.Children>
                        <Maps:Pushpin>
                            <Maps:MapLayer.Position>
                                <Maps:Location Latitude="{Binding Maps.Latitude}" Longitude="{Binding Maps.Longitude}" />
                            </Maps:MapLayer.Position>
                        </Maps:Pushpin>
                    </Maps:Map.Children>
                </Maps:Map>

推荐答案

根据此处的文档: http://msdn.microsoft.com/en-us/library/hh846504.aspx

地图的Center属性不支持数据绑定.我相信这样做是有目的的,因为地图移动时中心属性会频繁更改,并且数据绑定可能会导致很多性能问题.

The Center property of the map dos not support data binding. I believe this was done on purpose as the center property changes frequently when the map moves and data binding can cause a lot of performance issues.

这篇关于Win 8 App:Bing Maps绑定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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