我的地图上有一个图钉,但是当我单击并拖动地图时,图钉会停留在屏幕上的同一位置,并且不会随地图一起移动。如何将图钉放在特定的位置(坐标)上并保持在那里?这是我的XAML代码:
<Window x:Class="WPFKiosk.MapWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPFKiosk"
mc:Ignorable="d"
Title="MapWindow" Height="910" Width="1080" WindowStyle="None" ResizeMode="NoResize">
<!-- -->
<Grid Width="1080" Height="915">
<!-- <Image HorizontalAlignment="Left" Height="644" Margin="20,64,-35,0" VerticalAlignment="Top" Width="1095" Source="Images/map.png"/> -->
<m:Map x:Name="myMap" CredentialsProvider="My_Key" Mode="Road"/>
<m:Pushpin Location="28,-81"
/>
<Image HorizontalAlignment="Left" Height="100" Margin="510,740,0,0" VerticalAlignment="Top" Width="100" Source="Images/iTO Back Arrow.png" MouseLeftButtonDown="Image_MouseLeftButtonDown"/>
</Grid>
</Window>
图钉不在“在地图上”。
应该看起来像这样:
<m:Map x:Name="myMap" CredentialsProvider="My_Key" Mode="Road">
<m:Pushpin Location="28,-81"/>
</m:Map>