2011-12-09 44 views
1

我是新來的Windows Phone 7的,請幫我實現Windows Phone中的Bing地圖7

<phone:PhoneApplicationPage 
    x:Class="Sample1.PanoramaPage1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}" 
    SupportedOrientations="Portrait" Orientation="Portrait" 
    shell:SystemTray.IsVisible="False" 
    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" 
    xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"> 
    <my:Map x:Name="map1" CredentialsProvider="{Binding CredentialsProvider}" Height="462" HorizontalAlignment="Left" Margin="6,6,0,0" VerticalAlignment="Top" Width="444" > 
        <my:MapItemsControl x:Name="mapItemsControl" ItemsSource="{Binding Path=Locations}"> 
        <my:MapItemsControl.ItemTemplate> 
         <DataTemplate> 
          <m:Pushpin MouseLeftButtonUp="Pushpin_MouseLeftButtonUp" Background="Red" Location="{Binding}"> 

          </m:Pushpin> 
         </DataTemplate> 
        </my:MapItemsControl.ItemTemplate> 
       </my:MapItemsControl> 
       </my:Map> 

而且我.xaml.cs是這樣的:

public PanoramaPage1() 
     { 
      InitializeComponent(); 
      //map1.Mode = new RoadMode(); 
      Pushpin pushpin = new Pushpin(); 
      Location location = new Location(); 
      location.Latitude = 53.550556; 
      location.Longitude = 9.993333; 
      pushpin.Location = location; 
      pushpin.Background = new SolidColorBrush(Colors.Red); 
      map1.Children.Add(pushpin); 
} 

如果我們看到我有兩個(2)地圖控件添加到頁面這些是

xmlns:m =「clr-namespace:Microsoft.Maps.MapControl; assembly = Microsoft.Maps.MapControl」 xmlns:my =「clr-名稱空間:Microsoft.Phone.Controls.Maps;如sembly = Microsoft.Phone.Controls.Maps「

如果我使用的Microsoft.Maps.MapControl圖釘的地圖正在工作,但下面的代碼不起作用。

<m:Map.Mode> 
       <m:AerialMode ShouldDisplayLabels="True" /> 
       </m:Map.Mode> 

它給錯誤爲「類型‘AerialMode’未找到該物業‘ShouldDisplayLabels’。」

如果我使用Microsoft.Phone.Controls.Maps的地圖,那麼圖釘不起作用意味着圖釘在我們移動地圖時保持穩定(地圖移動但圖釘保持不動)。並且如果將兩個圖釘象下面這樣:

public PanoramaPage1() 
      { 
       InitializeComponent(); 
       //map1.Mode = new RoadMode(); 

       GeoCoordinate lHamburg = new GeoCoordinate(53.550556, 9.993333); 

       Pushpin pushpin = new Pushpin(); 
       Location location = new Location(); 
       location.Latitude = 53.550556; 
       location.Longitude = 9.993333; 
       pushpin.Location = location; 
       pushpin.Background = new SolidColorBrush(Colors.Red); 
       map1.Children.Add(pushpin); 

       pushpin = new Pushpin(); 
       location = new Location(); 
       location.Latitude = 83.550556; 
       location.Longitude = 9.993333; 
       pushpin.Location = location; 
       pushpin.Background = new SolidColorBrush(Colors.Yellow); 
       map1.Children.Add(pushpin); 
    } 

僅次於圖釘(Colors.Yellow),我能夠在地圖上查看。

請幫我一把。

+0

爲了防止任何混淆,請先刪除所有對「老」bing地圖控件的引用。由於地圖控件現在包含在SDK中,因此應刪除xmlns:m =「clr-namespace:Microsoft.Maps.MapControl; assembly = Microsoft.Maps.MapControl」。從項目參考中刪除對舊地圖控件的引用。 –

回答

相關問題