Windows phone 7 Windows Phone图钉重叠

Windows phone 7 Windows Phone图钉重叠,windows-phone-7,bing-maps,overlapping,pushpin,Windows Phone 7,Bing Maps,Overlapping,Pushpin,我正在编写一个简单的WindowsPhone7.5本地化应用程序 我已将默认图钉模板更改为: <ControlTemplate TargetType="maps:Pushpin" x:Key="allPushpinsTemplate"> <Grid Height="26" Width="26" Margin="-13,-13,0,0" RenderTransformOrigin="0.5,0.5" > <Grid.Rend

我正在编写一个简单的WindowsPhone7.5本地化应用程序

我已将默认图钉模板更改为:

 <ControlTemplate TargetType="maps:Pushpin"  x:Key="allPushpinsTemplate">
        <Grid Height="26" Width="26" Margin="-13,-13,0,0" RenderTransformOrigin="0.5,0.5" >
            <Grid.RenderTransform>
                <CompositeTransform Rotation="-45"/>
            </Grid.RenderTransform>
            <Rectangle Fill="Black" HorizontalAlignment="Center" Margin="0" Stroke="White" VerticalAlignment="Center" Height="26" Width="26"/>
            <Ellipse HorizontalAlignment="Center" Height="16" Margin="0" VerticalAlignment="Center" Fill="Red" Width="16"/>
        </Grid>
    </ControlTemplate>

单击图钉时,我会处理事件并将选定图钉的模板更改为:

        <ControlTemplate TargetType="maps:Pushpin"  x:Key="detailedPushpinTemplate">
            <Grid x:Name="ContentGrid" Background="Transparent" Margin="-4,0,0,0">
                <StackPanel >
                    <Grid Background="Black">
                        <StackPanel Margin="5,5,0,0">
                            <TextBlock  Text="{Binding Adress}" Foreground="White" />
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding ZipCode}" Foreground="White" />
                                <TextBlock Text="-" Foreground="White" Padding="3,0"/>
                                <TextBlock Text="{Binding City}" Foreground="White" />
                            </StackPanel>
                            <TextBlock Text="{Binding TelStd}" Foreground="White" />
                            <TextBlock Text="{Binding Email}" Foreground="White" />
                            <StackPanel Orientation="Horizontal">
                                <Button BorderBrush="Transparent" Click="Button_Click" CommandParameter="email" ClickMode="Press">
                                    <Button.Content>
                                        <Image Source="/Images/Icons/icon-mail.png" Width="40" Height="40" />
                                    </Button.Content>
                                </Button>
                                <Button BorderBrush="Transparent" Click="Button_Click" CommandParameter="phone" ClickMode="Press">
                                    <Button.Content>
                                        <Image Source="/Images/Icons/icon-phone.png" Width="40" Height="40" />
                                    </Button.Content>
                                </Button>
                            </StackPanel>
                        </StackPanel>
                    </Grid>
                    <Polygon Fill="Black"  Points="0,0 29,0 0,29" Width="29" Height="29" HorizontalAlignment="Left" />
                    <Grid Height="26" Width="26" Margin="-13,-13,0,0" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left">
                        <Grid.RenderTransform>
                            <CompositeTransform Rotation="-45"/>
                        </Grid.RenderTransform>
                        <Rectangle Fill="Black" HorizontalAlignment="Center" Margin="0" Stroke="White" VerticalAlignment="Center" Height="26" Width="26" />
                        <Ellipse HorizontalAlignment="Center" Height="16" Margin="0" VerticalAlignment="Center" Fill="Green" Width="16" />
                    </Grid>
                </StackPanel>
            </Grid>
    </ControlTemplate>

这样我可以显示一些信息和一些命令。结果运行良好,显示一个包含所有自定义数据的黑色矩形

但是,其他接点(默认模板)与矩形重叠,并显示在所选接点的顶部并隐藏信息

有没有人想强制所选的管脚模板始终位于其他管脚之上

有关我的地图的XAML的信息:

 <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Canvas >
            <maps:Map ZoomBarVisibility="Visible" ZoomLevel="4" Center="46.8821,2.2697"  Name="map1" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Canvas.Top="0" Height="600" Width="460">
                <maps:MapItemsControl  x:Name="mapControl"/>
                <maps:MapItemsControl ItemsSource="{Binding Locations}" >
                    <maps:MapItemsControl.ItemTemplate>
                        <DataTemplate>
                            <maps:Pushpin Location="{Binding Location}" Template="{StaticResource allPushpinsTemplate}" MouseLeftButtonDown="Pushpin_MouseLeftButtonDown"/>
                        </DataTemplate>
                    </maps:MapItemsControl.ItemTemplate>
                </maps:MapItemsControl>
                <maps:MapLayer Name="imageLayer"/>
                </maps:Map>
            <Button Content="some action" Height="70" HorizontalAlignment="Left" Margin="0" Name="button1" VerticalAlignment="Top" Width="170"  Canvas.Left="140" />
        </Canvas>

    </Grid>


我想这应该会对您有所帮助:

我解决此默认行为的唯一方法是删除原始pin,然后使用不同的模板在相同位置添加新pin。
新添加的管脚显示在Z顺序的顶部,但我无法在创建后更改现有管脚的Z顺序


另外,请记住,当用户单击另一个时,“重置”处于选定状态的任何管脚。

您好,我已经阅读了此线程,解决方案(图钉群集)在我的情况下不起作用。您好,谢谢您的想法。当你说“删除原始pin”时,你的意思是将其从映射中删除或从datacontext中删除?@SebastienRoche将其从映射中删除。由于绑定引脚的问题,我停止了自动绑定它们,并将它们添加到代码中。这使得处理这样的情况更加容易。