开发者

Bing Maps ZoomLevel not updating everytime when property changes

I have the following xaml for the MS Bing Maps control. ZoomLevel is bound to a property on the ViewModel called 'ZoomLevel'.

<Microsoft_Phone_Controls_Maps:Map x:Name="routeMap"
                                   ZoomLevel="{Binding ZoomLevel}"
                                   Center="{Binding CurrentMapCenterPoint, Mode=TwoWay}"
                                   AnimationLevel="UserInput"
                                   HorizontalContentAlignment="St开发者_如何学编程retch"
                                   VerticalContentAlignment="Stretch">

Now when the map is first shown the level of zoom is correct - it can be set from the ViewModel, but when the user changes the resolution and then does another search and the ZoomLevel property in the ViewModel is changed it does not update the control in the View - the old level of zoom is still being used.

Any ideas why the ZoomLevel can not be changed from the ViewModel once the Bing Maps control has been rendered?


The answer is to make the binding two way for the ZoomLevel property:

<Microsoft_Phone_Controls_Maps:Map x:Name="routeMap"
                                   ZoomLevel="{Binding ZoomLevel, Mode=TwoWay}"
                                   Center="{Binding CurrentMapCenterPoint, Mode=TwoWay}"
                                   AnimationLevel="UserInput"
                                   HorizontalContentAlignment="Stretch"
                                   VerticalContentAlignment="Stretch">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜