2012-05-31 34 views
1

如何在Windows Phone 7中點擊圖釘時顯示信息框?即當點擊圖釘時需要顯示數據右側的一些數據和箭頭按鈕。請幫助我...Windows Phone 7中的圖釘信息框中的示例bing地圖?

+0

截至目前我正在顯示上map.but圖釘如何顯示信息框時點擊那個? – WP7

+0

嘗試http://igrali.wordpress.com/2012/01/07/show-a-tooltip-for-tapped-pushpin-on-windows-phone/ –

+0

可能的重複[如何在點擊圖釘時顯示佈局在bingmaps?](http://stackoverflow.com/questions/10793881/how-to-show-the-layout-when-click-on-pushpin-in-bingmaps) – MarcinJuraszek

回答

0

您可以自定義圖釘

例如:

<my:Map Name="map1"> 

       <my:Map.Resources> 
        <DataTemplate x:Key="pushpinTpl"> 
         <my:Pushpin PositionOrigin="{Binding position}"> 
          <my:Pushpin.ContentTemplate> 
           <DataTemplate> 
            <ToggleButton x:Name="togButt" > 
             <Grid> 
              <TextBlock Text="click" 
                 Visibility="{Binding ElementName=togButt,Path=IsChecked,Converter={StaticResource BoolConverter},ConverterParameter=!}"/> 
              <TextBlock Text="alternative content" 
                 Visibility="{Binding ElementName=togButt,Path=IsChecked,Converter={StaticResource BoolConverter}}"/> 
             </Grid> 
            </ToggleButton> 
           </DataTemplate> 
          </my:Pushpin.ContentTemplate> 
         </my:Pushpin> 
        </DataTemplate> 
       </my:Map.Resources> 

       <my:MapItemsControl ItemsSource="{Binding items}" 
            ItemTemplate="{StaticResource pushpinTpl}" 
            /> 
      </my:Map> 

希望這有助於:)

當你點擊圖釘當時
+0

對不起@Dargos我不能給你一些樣本。 – WP7

1

您顯示消息框。 即在點擊事件把消息box.see婁編碼

     pin[i] = new Pushpin(); 
         pin[i].Location = new GeoCoordinate(Latitude, LongLatitude); 

         map1.Children.Add(pin[i]); 
         myCoorditeWatcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); 
         myCoorditeWatcher.MovementThreshold = 20; 

         var gl = GestureService.GetGestureListener(pin[i]); 
         gl.Tap += new EventHandler<GestureEventArgs>(GestureListener_Stack_Tap); 




private void GestureListener_Stack_Tap(object sender, Microsoft.Phone.Controls.GestureEventArgs e) 
     { 
      for (int i = 0; i <= ClsGetDeviceMap.lstLongLatitude.Count - 1; i++) 
      { 
       if (sender.Equals(pin[i])) 
       { 
        MessageBox.Show(ClsGetDeviceMap.lstLocationName.ElementAt<string>(i).Trim()); 
             MessageBox.Show(ClsGetDeviceMap.lstLatitude.ElementAt<string>(i).Trim()); 
        MessageBox.Show(ClsGetDeviceMap.lstLongLatitude.ElementAt<string>(i).Trim()); 

       } 
      } 
     }