2013-05-07 82 views
0

我用的Windows Phone 8在這裏,諾基亞地圖控制工作,以顯示在目前的代碼,我有(相關部分只)問題得到點的集合與諾基亞地圖

C#

public ObservableCollection<LocationViewModel> ItemLocations 
    { 
     get 
     { 
      return new ObservableCollection<LocationViewModel>() 
       { 
        new LocationViewModel() 
         { 
          Display = "MVVM Test", 
          Location = new GeoCoordinate(43.07441, -88.25609) 
         } 
       }; 
     } 
    } 

XAML:

<maps:Map Center="{Binding MapCenter, Mode=TwoWay}" 
       ZoomLevel="{Binding ZoomLevel}"> 
     <maptk:MapExtensions.Children> 
      <maptk:MapItemsControl ItemsSource="{Binding Path=ItemLocations}"> 
       <maptk:MapItemsControl.ItemTemplate> 
        <DataTemplate> 
         <maptk:Pushpin GeoCoordinate="{Binding Location}" Content="{Binding Display}" /> 
        </DataTemplate> 
       </maptk:MapItemsControl.ItemTemplate> 
      </maptk:MapItemsControl> 
     </maptk:MapExtensions.Children> 
    </maps:Map> 

眼下,在地圖頁面加載,它的正確位置爲中心,但是,無論我做什麼用ItemLocations名單我沒有得到任何對馬的顯示點數頁。我繼續靜態定義maptk:MapItemsControl.Items與一些靜態點,它工作正常,它只是當我嘗試綁定(如上所示),它失敗。

該解決方案使用Caliburn Micro for MVVM。正如你可以看到上面的例子,我硬編碼的視圖模型的位置列表,但得到永遠不會被調用,這對我來說是神祕的。如果我只將PushPins定義爲子MapExtensions.Children,它就可以工作。

我開始懷疑ItemsSource是不是可綁定的,但我覺得這很荒謬。請幫助

在此先感謝

回答