0

In UWP MapControl, I have an element (Stackpanel with an icon, nothing special) that I place on the map.

When the camera is higher than the element's altitude it is shown on the map, but when the camera goes down below the elements altitude, it disappears.

Here both cases: right the element that has disappeared):

with the element over the mountain Here, with the element over the mountain. Camera is higher that the element.

The element has disappeared

And here, The element has disappeared. Camera below element.

This is the code that I use to position on the map:

    MapControl.SetLocation(pinLandmarkPoint, LandmarkGeopoint);
    MapControl.SetNormalizedAnchorPoint(pinLandmarkPoint, new Point(0.5, 1));

Edit:

XAML part:

<Maps:MapControl x:Name="mapPosition">
         
         <!-- This is the element (stackpanel) that disappears -->
         <StackPanel x:Name="pinLandmarkPoint" RenderTransformOrigin="0.5,1" Visibility="Collapsed" 
                                    Holding="pinLandmarkPoint_Holding" RightTapped="pinLandmarkPoint_RighTapped">

              <StackPanel x:Name="spLandmarkInfo" Margin="10" Background="{ThemeResource MapControlsBackground}" Visibility="Collapsed" Canvas.ZIndex="100">
                    <StackPanel Margin="10">
                           <TextBlock x:Name="tbLandmarkInfoCoord" Text="lat: 42.3 long: -2.8278237" Margin="2.5"/>

                            <Rectangle Margin="5" Height="1" Fill="DarkGrey" />

                            <TextBlock x:Name="tbLandmarkInfoDistance" Text="Distance2,5km" Margin="2.5"/>
                            <TextBlock x:Name="tbLandmarkInfoAltitude" Text="Altitude: 120m (+65,3m)" Margin="2.5"/>

                            <Rectangle Margin="5" Height="1" Fill="Black"/>

                            <TextBlock x:Name="tbLandmarkInfoAzimuth" Text="Azimuth: 23º" Margin="2.5"/>
                            <TextBlock x:Name="tbLandmarkInfoElevation" Text="Elevation: +3.76º" Margin="2.5"/>
                       </StackPanel>
                  </StackPanel>

                  <Image x:Name="imgLandmark" Source="/Images/Maps/Landmark_point_96px.png" Margin="0" Width="25" Height="25" RenderTransformOrigin="0.5,1"/>
          </StackPanel>

</Maps:MapControl>

¿Any idea how can I fix this problem?

  • I can't reproduce the issue on my side. When attaching a point in the map, no matter how I changed the camera, the point is still visible. Maybe you could share more code that could reproduce this issue and the reproduce steps as well. – Roy Li - MSFT Sep 16 '21 at 02:35
  • From your screenshot I suspect the XAML element is simply falling in a location that is no longer visible (behind the mountain). In these cases the element will intentionally be hidden (it would make no sense to show the pin through the mountain). As an aside, for something as simple as a pushpin icon, it's strongly recommended to use MapIcon instead of XAML elements. It will perform much better and XAML has issues with not exactly syncing with map animations. – Duncan Lawler Sep 16 '21 at 16:18
  • It's not the case that when it falls behind a mountain the element will be hidden in the map view. I'll try changing XAML element to a MapIcon despite I don't know if an MapIcon can be flexible as to show something more than a simple text beside the icon (all the coordinates info, and the latitude, longitue, ... should be there also). – Imanol Zubiaurre Sep 16 '21 at 17:12
  • So does the MapIcon work? – Roy Li - MSFT Sep 20 '21 at 07:57
  • Yes and no... It fixes what I was asking, but now I can't trigger Holding and RightTapped events. – Imanol Zubiaurre Sep 25 '21 at 17:07

0 Answers0