经度未更新

Longitude is not updated

我有一个带有按钮 Select/Cancel 的 mapControl 和两个用于查看坐标的 TextBlock。点击 Select 按钮后,正在根据获取的坐标(LatitudeMap 和 LongitudeMap)计算地址。

    private async void SelectCoordinate_Tapped(object sender, TappedRoutedEventArgs e)
    {
        LatitudeText = LatitudeMap;
        LongitudeText = LongitudeMap;

        MapLocationFinderResult result = await reverseGeocode(sender, e);
        if (result.Status == MapLocationFinderStatus.Success)
        {
            AddressText = result.Locations[0].Address.Town + "," + result.Locations[0].Address.Street + "," + result.Locations[0].Address.StreetNumber;
        }
        MapVisibility = false;
    }

在地图上点击后得到的LatitudeMap和LongitudeMap:

    private void AddMapIcon_Tapped(MapControl sender, MapInputEventArgs args)
    {
        MapIcon icon;
        icon = new MapIcon();

        if (icon != null)
        {
            MapWithPin.MapElements.Clear();
        }

        var tappedGeoPosition = args.Location.Position;
        Geopoint Point = new Geopoint(new BasicGeoposition() { Latitude = tappedGeoPosition.Latitude, Longitude = tappedGeoPosition.Longitude });
        icon = new MapIcon { Location = Point, NormalizedAnchorPoint = new Point(0.5, 1.0), ZIndex = 0 };
        MapWithPin.MapElements.Add(icon);
        MapWithPin.Center = Point;

        LatitudeMap = Convert.ToString(tappedGeoPosition.Latitude);
        LongitudeMap = Convert.ToString(tappedGeoPosition.Longitude);
        Select.IsEnabled = true;
    }

问题是在 LontitudeTextBlock 中看不到 LontitudeText。

我认为问题出在 LongitudeTexttProperty 依赖项 属性 名称中的拼写错误。应该是LongitudeTextProperty

    public string LatitudeText
    {
        get { return (string)GetValue(LatitudeTextProperty); }
        set { SetValue(LatitudeTextProperty, value); }
    }

    public static readonly DependencyProperty LatitudeTextProperty =
        DependencyProperty.Register(nameof(LatitudeText), typeof(string), typeof(AddLocationControl), new PropertyMetadata(null, (d, e) => {}));


    public string LongitudeText
    {
        get { return (string)GetValue(LongitudeTextProperty); }
        set { SetValue(LongitudeTextProperty, value); }
    }

    public static readonly DependencyProperty LongitudeTextProperty =
        DependencyProperty.Register(nameof(LongitudeText), typeof(string), typeof(AddLocationControl), new PropertyMetadata(null, (d, e) => {}));

正确 属性.