我有如下XAML代码:
<Ellipse x:Name="node" Height="10" Width="10" map:MapCanvas.Latitude="{Binding Latitude}" map:MapCanvas.Longitude="{Binding Longitude}"
Fill="Red" Stroke="Red" StrokeThickness="1" Stretch="Uniform"
</Ellipse>
并且这个
xmlns:map="clr-namespace:MapControl;assembly=MapControl"
这里是MapCanvas类中的依赖属性:
public static readonly DependencyProperty LatitudeProperty =
DependencyProperty.RegisterAttached("Latitude", typeof(double), typeof(MapCanvas), new PropertyMetadata(double.PositiveInfinity, OnLatitudeLongitudePropertyChanged));
public static readonly DependencyProperty LongitudeProperty =
DependencyProperty.RegisterAttached("Longitude", typeof(double), typeof(MapCanvas), new PropertyMetadata(double.PositiveInfinity, OnLatitudeLongitudePropertyChanged));
我知道之前有类似的问题,但我的问题是如何在代码中实现与XAML代码中经度和纬度相同的绑定?