WPF Bing Maps - Unwanted Pushpin in center of map

366 views Asked by At

I have a persistent problem regarding my bing maps application. I've got an ItemTemplate describing a pushpin bounded to an Observable Collection of Point of Interest objects (containing the typical WPF Bing Maps Location object).

The pushpins successfully represent whatever POIs my collection contains at the moment, however, there's always one pushpin right in the center of the map, which won't go away. It stays there even when I move the map around or when no other POIs at all are selected... Maybe you can help me out here.

Here's my Data Template (in MainWindow.xaml):

<DataTemplate x:Key="POITemplate">
    <m:Pushpin m:MapLayer.Position="{Binding Location}"  Tag="{Binding}">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Pushpin_MouseEnter">
                <i:InvokeCommandAction Command="{Binding Pushpin_MouseEnter}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </m:Pushpin>
</DataTemplate>

Here I'm 'calling' (I don't know the right terminology for XAML) the POIs:

<m:Map x:Name="myMap" 
       Margin="0,0,0.5,287.5" 
       CredentialsProvider={StaticResource MyCredentials}" 
       Center="48.20882,16.3739634,0.0000" 
       ZoomLevel="14.000" 
       AnimationLevel="None" 
       Mode="Road"
       Core:MapInteractivity.RouteResult="{Binding RouteResult}"
       Core:MapInteractivity.RouteLineLayer="{Binding ElementName=RouteLineLayer}">
    <m:Map.Children>
        <m:MapItemsControl ItemsSource="{Binding PoiList}" 
                           ItemTemplate="{StaticResource POITemplate}"/>
        <m:MapLayer x:Name="RouteLineLayer" />
        <m:MapLayer>
            <m:MapItemsControl ItemsSource="{Binding Directions}"
                               ItemTemplate="{StaticResource RouteTemplate}" 
                               Margin="0,30,0,-30"/>
        </m:MapLayer>
        <m:MapLayer x:Name="ContentPopupLayer">
            <Grid x:Name="ContentPopup" 
                  Visibility="Collapsed" 
                  Background="White" 
                  Opacity="0.85">
                <StackPanel Margin="15">
                    <TextBlock x:Name="ContentPopupText" 
                               FontSize="12" 
                               FontWeight="Bold" ></TextBlock>
                    <TextBlock x:Name="ContentPopupDescription" 
                               FontSize="12"></TextBlock>
                </StackPanel>
            </Grid>
        </m:MapLayer>
    </m:Map.Children>
</m:Map>

My DataContext is the MainViewModel, which contains a property of ObservableCollection which in turn contains the WPF Location object.

I really appreciate any answers. Thank you guys!

0

There are 0 answers