【发布时间】:2021-01-15 13:27:05
【问题描述】:
我的 WPF 应用程序 UserControl 包含一个 GMap 控件。
<UserControl x:Class="Test.test.Map"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gmmapeprovider="clr-namespace:GMap.NET.MapProviders;assembly=GMap.NET.Core"
xmlns:prism="http://prismlibrary.com/"
xmlns:windowspresentation="clr-namespace:GMap.NET.WindowsPresentation;assembly=GMap.NET.WindowsPresentation" prism:ViewModelLocator.AutoWireViewModel="True">
<Grid >
<windowspresentation:GMapControl
x:Name="mapView" MinZoom="1"
Position="{Binding MapPosition}"
MaxZoom="17"
Zoom="{Binding MapZoom}"
MouseWheelZoomEnabled="True"
MouseWheelZoomType ="MousePositionWithoutCenter"
MapProvider="{x:Static gmmapeprovider:GoogleMapProvider.Instance}"
CacheLoc="{Binding XmlFilePath}"
IgnoreMarkerOnMouseWheel="True"/>
</Grid>
</UserControl>
地图 Position 绑定到 UserControl 的 ViewModel 中的 MapPosition 属性。每次我使用鼠标右键平移地图时,单击并拖动功能,MapPosition 的值都会更新。
这是我的担忧: 我的期望是,如果地图被缩放,当鼠标指针不在控件的中心时,也应该更新 Position 的值。显然,情况并非如此,位置保持不变,除非再次平移地图。
我是否在这里遗漏了一些设置,或者是否有任何可能的解决方法来解决这个问题?
【问题讨论】:
标签: c# wpf wpf-controls gmap.net