WP7必应地图根据图钉收集位置的缩放级别 [英] WP7 Bing Maps Zoom level based on Push Pin collection locations
问题描述
关于使用以下代码段的一个简短问题:
Just a quick question regarding the use of the following code snippet:
var locations = CurrentItems.Select(model => model.Location);
map.SetView(LocationRect.CreateLocationRect(locations));
在此答案中建议: 缩放以显示bing地图中的所有位置
我正在异步获取一个地理坐标列表,并使用ObservableCollection将其绑定到Bing地图;使用以下命令将结果数据复制到主UI线程中:
I am retrieving a list of geocoordinate asynchrounsly and binding these to a Bing Map using an ObservableCollection; copying the resultant data over to the main UI thread using:
Deployment.Current.Dispatcher.BeginInvoke( ()=> {...} )
我的问题是,我不能在Dispatcher中引用地图控件(或者可以吗?),那么如何使用以下方法将新的图钉位置应用于地图:
My problem is that, I can't reference the map control within the Dispatcher (or can I??), so how can I apply the new Pushpin locations to the map using:
map.SetView(LocationRect.CreateLocationRect(locations));
谢谢,
推荐答案
我也许您会发现这篇文章很有用.要绑定地图视图和ViewModel,所描述的方法使用DependecyPropety: http://sveiberg.wordpress.com/2012/06/24/5/.
I perhaps you will find this post useful. To bind the view of the map and the ViewModel, the method described use a DependecyPropety : http://sveiberg.wordpress.com/2012/06/24/5/.
这篇关于WP7必应地图根据图钉收集位置的缩放级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!