none
PushPin offset while zooming out using WPF bing map control RRS feed

  • Question

  • Dear all,

    I have a wierd issue where when I zoom in to  a push pin it is place correctly at the location but while zooming out, the pushpin is not staying at proper location and get shifted as shown bellow :

    Zoom in :

    Zoom out :

    You can see from the picture above that it is set in the water. Any help ?

    regards

    serge


    Your knowledge is enhanced by that of others.

    Friday, May 31, 2013 4:43 PM

Answers

  • This usually has to do with the pin point not being where the pushpin is being anchored. If using the pushpin class take a look at the PositionOrigin property. If using a custom control then use Margins to offset the pin. If anchored at the top left corner then the left margin would need to negative the distance from the left side of the image to the pin point and the top margin would need to be the negative height of the image.

    http://rbrundritt.wordpress.com

    Friday, May 31, 2013 5:28 PM
  • On the outside grid of the custom pushpin try adding a margin that moves left 15 pixels and up 35 pixels. You may need to adjust these a bit but try that and see how the pushpins is offset and if this makes an improvement.

    http://rbrundritt.wordpress.com

    Monday, June 3, 2013 8:47 AM

All replies

  • This usually has to do with the pin point not being where the pushpin is being anchored. If using the pushpin class take a look at the PositionOrigin property. If using a custom control then use Margins to offset the pin. If anchored at the top left corner then the left margin would need to negative the distance from the left side of the image to the pin point and the top margin would need to be the negative height of the image.

    http://rbrundritt.wordpress.com

    Friday, May 31, 2013 5:28 PM
  • HI richard,

    my pushpin datatemplate is define as follow :

    <DataTemplate x:Key="LocationPushpin">
                    <Grid m:MapLayer.Position="{Binding Location, Converter={StaticResource LocationToLatLongConverter},UpdateSourceTrigger=PropertyChanged}"
                                m:MapLayer.PositionOrigin="BottomCenter" m:MapLayer.PositionOffset="17.5,0"  >
                        <!--<m:Pushpin Location="{Binding Location, Converter={StaticResource LocationToLatLongConverter},UpdateSourceTrigger=PropertyChanged}"/>-->
                        <ctrl:PushPinControl DataContext="{Binding }"/>
                        <Grid.RenderTransform>
                            <RotateTransform Angle="{Binding ElementName=wmap, Path=Heading}"/>
                        </Grid.RenderTransform>
                    </Grid>
                </DataTemplate>

    And my Pin Custom Contol is define as below :

    <Grid >
            <Border Height="35" VerticalAlignment="Top" Background="White" CornerRadius="28,0,0,26">
                <Image x:Name="Logo" Margin="0,0,2,0" Source="{Binding PropertyDetailViewModel.CorpLogoUri,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource UriToBitmapImageConverter}}" HorizontalAlignment="Right" VerticalAlignment="Center" Width="30"/>
            </Border>
            <Path Stretch="Fill" StrokeThickness="0.32" StrokeLineJoin="Round" Stroke="Gray" Fill="White" Data="F1 M 8.53332,22.8867C 8.53332,22.8867 1.85679,15.7006 0.369645,12.6362C -0.217433,11.4264 -0.546685,10.0683 -0.546685,8.63334C -0.546685,3.56335 3.56335,-0.546684 8.63333,-0.546684C 13.7033,-0.546684 17.8133,3.56335 17.8133,8.63334C 17.8133,10.0725 17.4822,11.4342 16.8919,12.6466C 15.4027,15.7054 8.53332,22.87 8.53332,22.8867 Z " Width="30" Height="40" VerticalAlignment="Top" HorizontalAlignment="Left"/>
            <Ellipse Width="28" Height="28" Fill="{Binding IsFeature,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource IsFeatureToColorConverter}}" Margin="1,1,0,0"  VerticalAlignment="Top" HorizontalAlignment="Left">
                
            </Ellipse>
    
            <Image Width="15" Height="15" Source="{Binding PictoUri,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource UriToBitmapImageConverter}}" Margin="7,3,44,36" />
            <!--<Path x:Name="Path" Width="15" Height="15" 
                 
                  Stretch="Fill" Fill="White" VerticalAlignment="Top" 
                  Data="F1 M 4.11014,10.7493C 2.63708,5.17929 7.61,4.67159 7.61,4.67159C 5.16755,5.68567 4.2022,9.32092 4.11014,10.7493 Z M 28.1529,1.52643C 21.4023,-3.13779 16.0625,4.3507 16.0625,4.3507C 16.0625,4.3507 10.724,-3.13779 3.97339,1.52643C -2.77721,6.19066 0.660368,13.801 2.37713,16.0106C 4.09389,18.2215 16.0625,30.2741 16.0625,30.2741C 16.0625,30.2741 28.0297,18.2215 29.7492,16.0106C 31.4659,13.801 34.9035,6.19066 28.1529,1.52643 Z " Margin="7,8,43,0" />-->
        </Grid>

    IF I am zooming close to the location the position seems to be correct ...but while zoomiong out is issue.

    Any suggestion based on my code snipet above ?

    regards

    serge


    Your knowledge is enhanced by that of others.

    Saturday, June 1, 2013 8:53 AM
  • On the outside grid of the custom pushpin try adding a margin that moves left 15 pixels and up 35 pixels. You may need to adjust these a bit but try that and see how the pushpins is offset and if this makes an improvement.

    http://rbrundritt.wordpress.com

    Monday, June 3, 2013 8:47 AM