user3136572
user3136572

Reputation: 134

UWP MapControl issue anchoring xaml children

I'm new to UWP MapControl currently. I have a simple problem when adding XAML children to map (instead of the regular map elements).

this is my code:

    private void MapRightTapped(MapControl sender, MapRightTappedEventArgs args)
    {
        Ellipse circle = new Ellipse() { Height = 20, Width = 20, Fill = new SolidColorBrush(Colors.Black)};
        sender.Children.Add(circle);

        Geopoint position = new Geopoint(new BasicGeoposition()
        {
            Latitude = args.Location.Position.Latitude,
            Longitude = args.Location.Position.Longitude,
            Altitude = 5000,

        });
        MapControl.SetLocation(circle, position);
        MapControl.SetNormalizedAnchorPoint(circle, new Point(0.5, 0.5));
     }

At first the point displayed correctly on the map. but after zooming or tilting the map, the circle appeared to be anchored at the surface altitude and NOT at altitude of 5000

Upvotes: 0

Views: 201

Answers (1)

Duncan Lawler
Duncan Lawler

Reputation: 1772

You need to set an altitude reference system. Leaving it set to the default of unspecified will cause the altitude value to be ignored.

Upvotes: 3

Related Questions