在Windows Phone 7 bing地图上的Pushpin信息框上的样本?

时间:2012-05-31 06:15:46

标签: windows-phone-7

单击windows phone 7中的图钉时如何显示信息框?即点击图钉需要在数据右侧显示一些数据和箭头按钮。请帮助我...

3 个答案:

答案 0 :(得分:1)

当您点击图钉时,显示消息框。 即在您的点击事件放置消息框中。请参见下面的编码

                        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());

                }
          }
        }

答案 1 :(得分: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>

希望这有帮助:)

答案 2 :(得分:0)

Bind sdk网站上有很多例子: http://www.bingmapsportal.com/isdk/ajaxv7