2012-06-14 77 views
0
private void Pushpin_Tap(object sender, 
     System.Windows.Input.GestureEventArgs e) 
    { 
     var _ppmodel = sender as Pushpin; 
     ContextMenu contextMenu = 
      ContextMenuService.GetContextMenu(_ppmodel); 
     contextMenu.DataContext = _viewModel.Pushpins.Where 
      (c => (c.Location 
       == _ppmodel.Location)).FirstOrDefault(); 
     if (contextMenu.Parent == null) 
     { 
      contextMenu.IsOpen = true; 
     } 
    } 

這裏在條件我收到錯誤,如「沒有定義它」。請告訴我在Windows Phone 7中的圖釘點擊事件錯誤?

+0

什麼是錯誤你越來越多了?它發生了什麼? –

+0

contextMenu.DataContext = _viewModel.Pushpins.Where (c =>(c.Location == _ppmodel.Location))。FirstOrDefault(); in where條件。 – WP7

+0

什麼是錯誤?消息和/或堆棧跟蹤? –

回答

2

確保您有使用說明正確的文件

using System.Linq; 
+0

使用http://示例go.microsoft.com/fwlink/?LinkID=229125我添加了一個加載的事件並設置了zoomlevel,它工作正常 –

相關問題