0

シンプルな Windows Phone 7.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>
4

2 に答える 2

1

このデフォルトの動作を回避できる唯一の方法は、元のピンを削除してから、別のテンプレートで同じ位置に新しいピンを追加することです。
新しく追加されたピンは Z オーダーの上部に表示されますが、作成した既存のピンの Z オーダーを変更できませんでした。

また、ユーザーが別のピンをクリックしたときに、選択された状態のピンを「リセット」することを忘れないでください。

于 2012-10-03T09:57:25.590 に答える
0

これが役立つと思います:http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/c4055dba-3efd-4bf7-98b3-cd8e24d175ea

于 2012-10-03T09:42:33.643 に答える