0
嗨,我試圖讓我的必應地圖api閱讀一個文本框,將有一個郵政編碼或地址,它將找到。目前經過大量的試驗和錯誤,我已經得到它來搜索通過座標座標已經直接鍵入我的Xaml按鈕內的標籤選項我想知道是否有人想知道如何添加一個用戶可以簡單地輸入地址的文本框必應地圖文本框搜索
文本框(地址) - >按鈕(點擊)---->地圖searchs
當前XAML代碼
<Window
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" mc:Ignorable="d" x:Class="MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid >
<m:Map CredentialsProvider="MY KEY" x:Name="BingMap">
<Button Content="Button" HorizontalAlignment="Left" Height="30" VerticalAlignment="Top" Width="99" Margin="92,279,0,0" Click="ChangeMapView_Click" x:Name="BTN1" Tag="39.3683,-95.2734,0.0000 4.0000"/>
<TextBox HorizontalAlignment="Left" Height="32" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="111" Margin="212,277,0,0" x:Name="TXT1"/>
</m:Map>
</Grid>
</Window>
VB代碼
Private Sub ChangeMapView_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Parse the information of the button's Tag property
Dim tagInfo() As String = (CType(sender, Button)).Tag.ToString().Split(" "c)
Dim center As Location = CType(locConverter.ConvertFrom(tagInfo(0)), Location)
Dim zoom As Double = System.Convert.ToDouble(tagInfo(1))
' Set the map view
BingMap.SetView(center, zoom)
End Sub